Simple Coding Help - No Promise.

_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel",colorGrey40)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel upper",colorGrey40),ParamColor("Inner panel lower",colorBlack));
tchoice=Param("Title Selection ",2,1,2,1);

Plot(C, "", IIf(O>=C, colorOrange, colorGreen), ParamStyle("Price Style",styleCandle, maskPrice));

//////////////////////////////////////////////////////////////////
_SECTION_BEGIN("Fib Retracements");
fibs = ParamToggle("Plot Fibs","Off|On",1);
pctH = Param ("Pivot Hi %", 0.325,0.001,2.0,0.002);
HiLB = Param ("Hi LookBack",1,1,BarCount-1,1);
pctL = Param ("Pivot Lo %", 0.325,0.001,2.0,0.002);
LoLB = Param ("Lo LookBack",1,1,BarCount-1,1);
Back = Param ("Extend Left = 2",1,1,500,1);
Fwd = Param("Plot Forward", 0, 0, 500, 1);
text = ParamToggle("Plot Text","Off|On",1);
hts = Param ("Text Shift", -33.5,-50,50,0.10);
style =ParamStyle("Line Style",styleLine,styleNoLabel);
x = BarIndex();
pRp = PeakBars( H, pctH, 1) == 0;
yRp0 = SelectedValue(ValueWhen( pRp, H, HiLB));
xRp0 = SelectedValue(ValueWhen( pRp, x, HiLB));
pSp = TroughBars( L, pctL, 1) == 0;
ySp0 = SelectedValue(ValueWhen( pSp, L, LoLB));
xSp0 = SelectedValue(ValueWhen( pSp, x, LoLB));
Delta = yRp0 - ySp0;

function fib(ret)
{
retval = (Delta * ret);
Fibval = IIf(ret < 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret < 1.0
AND xSp0 > xRp0, ySp0 + retval,IIf(ret > 1.0
AND xSp0 < xRp0, yRp0 - retval, IIf(ret > 1.0
AND xSp0 > xRp0, ySp0 + retval, Null))));
return FibVal;
}

x0 = Min(xSp0,xRp0)-Back;
x1 = (BarCount -1);
//////////////////////////////////////////////////////////////////
r236 = fib(0.236); r236I = LastValue (r236,1);
r382 = fib(0.382); r382I = LastValue (r382,1);
r050 = fib(0.50); r050I = LastValue (r050,1);
r618 = fib(0.618); r618I = LastValue (r618,1);
r786 = fib(0.786); r786I = LastValue (r786,1);
e127 = fib(1.27); e127I = LastValue (e127,1);
e162 = fib(1.62); e162I = LastValue (e162,1);
e200 = fib(2.00); e200I = LastValue (e200,1);
e262 = fib(2.62); e262I = LastValue (e262,1);
e424 = fib(4.24); e424I = LastValue (e424,1);
//////////////////////////////////////////////////////////////////
p00 = IIf(xSp0 > xRp0,ySp0,yRp0); p00I = LastValue (p00,1);
p100 = IIf(xSp0 < xRp0,ySp0,yRp0); p100I = LastValue (p100,1);
color00 =IIf(xSp0 > xRp0,colorLime,colorRed);
color100 =IIf(xSp0 < xRp0,colorLime,colorRed);
//////////////////////////////////////////////////////////////////
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
//////////////////////////////////////////////////////////////////
if(fibs==1)
{
Plot(LineArray(xRp0-Fwd,yRp0,x1,yRp0,Back),"PR",32,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(xSp0-Fwd,ySp0,x1,ySp0,Back),"PS",27,8|styleNoRescale,Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r236,x1,r236,Back),"",45,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r382,x1,r382,Back),"",44,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r050,x1,r050,Back),"",41,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r618,x1,r618,Back),"",43,style|styleNoRescale, Null, Null,Fwd);
Plot(LineArray(x0-Fwd,r786,x1,r786,Back),"",42,style|styleNoRescale, Null, Null,Fwd);
//Plot(LineArray(x0-Fwd,e127,x1,e127,Back),"e127",47,style|styleNoRescale,Null, Null,Fwd);
//Plot(LineArray(x0-Fwd,e162,x1,e162,Back),"e162",47,style|styleNoRescale,Null, Null,Fwd);
//Plot(LineArray(x0-Fwd,e200,x1,e200,Back),"p200",47,style|styleNoRescale,Null, Null,Fwd);
//Plot(LineArray(x0-Fwd,e262,x1,e262,Back),"p262",47,style|styleNoRescale,Null, Null,Fwd);
//Plot(LineArray(x0-Fwd,e424,x1,e424,Back),"p424",25,style|styleNoRescale,Null, Null,Fwd);
}
//////////////////////////////////////////////////////////////////
if(text==1)
{
PlotText(" 0% = " + WriteVal(p00,fraction), LastValue(BarIndex())-(numbars/hts), p00I + 0.05, color00);
PlotText("23% = " + WriteVal(r236,fraction), LastValue(BarIndex())-(numbars/hts), r236I + 0.05, 45);
PlotText("38% = " + WriteVal(r382,fraction), LastValue(BarIndex())-(numbars/hts), r382I + 0.05, 44);
PlotText("50% = " + WriteVal(r050,fraction), LastValue(BarIndex())-(numbars/hts), r050I + 0.05, 41);
PlotText("62% = " + WriteVal(r618,fraction), LastValue(BarIndex())-(numbars/hts), r618I + 0.05, 43);
PlotText("78% = " + WriteVal(r786,fraction), LastValue(BarIndex())-(numbars/hts), r786I + 0.05, 42);
PlotText("100% = " + WriteVal(p100,fraction), LastValue(BarIndex())-(numbars/hts),p100I + 0.05, color100);
//PlotText("127% = " + WriteVal(e127,fraction), LastValue(BarIndex())-(numbars/hts),e127I + 0.05, 47);
//PlotText("162% = " + WriteVal(e162,fraction), LastValue(BarIndex())-(numbars/hts),e162I + 0.05, 47);
//PlotText("200% = " + WriteVal(e200,fraction), LastValue(BarIndex())-(numbars/hts),e200I + 0.05, 47);
//PlotText("262% = " + WriteVal(e262,fraction), LastValue(BarIndex())-(numbars/hts),e262I + 0.05, 47);
//PlotText("424% = " + WriteVal(e424,fraction), LastValue(BarIndex())-(numbars/hts),e424I + 0.05, 25);
}
_SECTION_END();

//////////////////////////////////////////////////////////////////

if (tchoice==2 )
{
Title = EncodeColor(colorWhite)+ Date() + " Tick = " + EncodeColor(5) + Interval()+
EncodeColor(colorWhite) + " Open = " + EncodeColor(colorWhite) + O +
EncodeColor(colorWhite) + " High = " + EncodeColor(5) + H +
EncodeColor(colorWhite) + " Low = " + EncodeColor(colorRed) + L +
EncodeColor(colorWhite) + " Close = " + EncodeColor(colorWhite) + C + "\n" +
EncodeColor( colorWhite) +"_______________"+"\n"+
EncodeColor( colorWhite) + "424% = " + EncodeColor(25)+ e424 + " " +"\n"+
EncodeColor( colorWhite) + "262% = " + EncodeColor(47)+ e262 + " " +"\n"+
EncodeColor( colorWhite) + "200% = " + EncodeColor(47)+ e200 + " " +"\n"+
EncodeColor( colorWhite) + "162% = " + EncodeColor(47)+ e162 + " " +"\n"+
EncodeColor( colorWhite) + "127% = " + EncodeColor(47)+ e127 + " " +"\n"+
EncodeColor( colorYellow) + " Res = " + EncodeColor(32)+ p100 + " " +"\n"+
EncodeColor( colorWhite) + " 78% = " + EncodeColor(42)+ r786 + " " +"\n"+
EncodeColor( colorWhite) + " 62% = " + EncodeColor(43)+ r618 + " " +"\n"+
EncodeColor( colorWhite) + " 50% = " + EncodeColor(41)+ r050 + " " +"\n"+
EncodeColor( colorWhite) + " 38% = " + EncodeColor(44)+ r382 + " " +"\n"+
EncodeColor( colorWhite) + " 23% = " + EncodeColor(45)+ r236+ " " +"\n"+
EncodeColor( colorYellow) + " Sup = " + EncodeColor(34)+ p00 + " " ;
}
GraphXSpace=5;

SetChartOptions(1, chartShowDates); // put dates at bottom of chart


Dear Ajit

Here is Fib level file, previous one was Fib Pivots. Just click on any top or bottom it will take required top and bottom for calculation of fib levels.

Thanks and regards,

Maruti Mane
 
Last edited:

toocool

Well-Known Member
Try this

Code:
_SECTION_BEGIN("ERO ATR BUY SELL");
 
ero = Param("ATR multiple", 2.8, 0.5, 10, 0.1 )*Param("ATR period", 10, 3, 50 );  
ero_col=ParamColor( "Color", colorCycle );
 
r=HHV(H,ero);
s=LLV(L,ero);
ab=IIf(H>Ref(r,-1),1,IIf(L<Ref(s,-1),-1,0));
ac=ValueWhen(ab!=0,ab,1);
sl=IIf(ac==1,s,r);
 
Plot(sl, _DEFAULT_NAME(), ero_col, styleStaircase); // or styleaArea
 
Buy=Cross(H,sl);
Sell=Cross(sl,L);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);                      
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();
 
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();
Or Try this
Code:
_SECTION_BEGIN( "fcVS" );
period  = Param( "Period", 13, 1, 240, 1 );
mult    = Param( "Multiplier", 1.7, 1, 240, 0.1 );
 
f = ATR( period );
 
VS[0] = Close[0];
trend[0] = 0;
HighC[0] = 0;
Lowc[0] = 0;
 
for ( i = period + 1; i < BarCount; i++ )
{
 
    vs[i]       = vs[i-1];
    trend[i]    = trend[i-1];
    highC[i]    = HighC[i-1];
    lowc[i] = lowc[i-1];
 
    if ( ( trend[i] >= 0 ) && ( C[i] < VS[i] ) )
    {
        trend[i] = -1;
        HighC[i] = C[i];
        lowc[i] = C[i];
    }
 
    if ( ( trend[i] <= 0 ) && ( C[i] > VS[i] ) )
    {
        trend[i] = 1;
        HighC[i] = C[i];
        lowc[i] = C[i];
    }
 
    if ( trend[i] == -1 )
    {
        if ( C[i] < lowc[i] )
            lowc[i] = C[i];
 
        VS[i] = lowc[i] + ( mult * f[i] );
    }
 
 
    if ( trend[i] == 1 )
    {
        if ( C[i] > HighC[i] )
            HighC[i] = C[i];
 
        VS[i] = HighC[i] - ( mult * f[i] );
    }
 
}
 
 
Buy = Cross( Trend, 0 );
Sell = Cross( 0, Trend );
 
Plot( Close, "Close", colorBlack, styleCandle );
Plot( VS, "Vol Stop", IIf( trend == 1, 10, 11 ), styleThick );
 
mkol    = IIf( Trend == 1, 10,  11 );
Plot( 5, "ribbon", mkol, styleOwnScale | styleArea | styleNoLabel, 0, -5 ); // Weekly trend
 
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;
PlotShapes( shape, IIf( Buy, colorGreen, colorRed ), 0, IIf( Buy, Low - f, High + f ) );
_SECTION_END();

hi @amit

the 1st afl however looks like it should ,but its more like a trading system giving buy and sells and so the ATR is not a true ATR in this , as you can see in chart even on 5 minute chart with 13 period and 2 multiple the ATR line is more then 100 points away , but that should not be the case here , the ATR is near 16 in one candle on 8 july near closing so maximum 32 point stop loss should be drawn ..............so its actually not what i was looking for , i need a true ATR which draws exactly like this(with actual ATR stop line drawn) bro and goes above and below candles as per the trend..............kindly help :thumb::thumb:
 
Dear Ajit,

Now only solution is Kelvin or Happy could help for that, they can modify the code from dynamic to static. I am only the collector of AFL, Ihave not AFL advance knowledge, so sorry for the same.

Thanks and regards,

Maruti Mane
 
hello and thanks for all ,can you convert 2 metatrader indicator code to amibroker , many many thanks for all of you , special KelvinHand for your help ,
//----------------------------------------------------------------------------------------------
//#1indicator nst
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Orange
#property indicator_level1 -50
#property indicator_level2 0
#property indicator_level3 50
#property indicator_levelcolor Gray
#property indicator_levelstyle 2
#property indicator_minimum -100
#property indicator_maximum 100

extern int NST_period = 20;
extern int SmLen = 10;


static datetime lastcalctime;

double NST[];
double RawNST[];
double maNST[];

double fC0Buffer[];
double fA8Buffer[];
double fC8Buffer[];
double list[128], ring1[128], ring2[11], buffer[62];
bool initFlag;
int limitValue, startValue, loopParam, loopCriteria;
int cycleLimit, highLimit, counterA, counterB;
double cycleDelta, lowDValue, highDValue, absValue, paramA, paramB;
double phaseParam, logParam, JMAValue, series, sValue, sqrtParam, lengthDivider;
int s58, s60, s40, s38, s68;

int init()
{
if(SmLen < 5) SmLen = 5;
else if(SmLen > 15) SmLen = 15;
string nstname = "NST(" + NST_period + ", " + SmLen + ")";
IndicatorShortName(nstname);
IndicatorDigits(0);
IndicatorBuffers(3);
SetIndexBuffer(0, NST);
SetIndexLabel(0, nstname);
SetIndexBuffer(1, RawNST);
SetIndexBuffer(2, maNST);
return(0);
}

int start()
{

if(bars <= NST_period + 3*SmLen) return(0);
if(counted_bars < 0) counted_bars = 0;
if(counted_bars > NST_period) limit = bars - counted_bars;
else limit = bars - NST_period - 1;

for(i = limit; i >= 0; i--)
{
double SumWgt = 0, SumDnm = 0, HghAry, LowAry, RngAry, FrcAry, TmeAry, WgtAry;
for(ii = 0; ii <= NST_period; ii++)
{
if(ii < 2) HghAry = High; else HghAry = High[iHighest(NULL, 0, MODE_HIGH, ii, i)];
if(ii < 2) LowAry = Low; else LowAry = Low[iLowest(NULL, 0, MODE_LOW, ii, i)];
RngAry = HghAry - LowAry;
if(RngAry == 0) FrcAry = 0; else FrcAry = (Close - LowAry) / RngAry;
TmeAry = 1 / MathPow(ii+1, 0.5);
WgtAry = TmeAry * FrcAry;
SumWgt += WgtAry;
SumDnm += TmeAry;
}
RawNST = (200 * SumWgt / SumDnm) - 100;
}

double ExpSmooth = 2, XAvg1, XAvg2, XAvg3;
ExpSmooth = ExpSmooth / (SmLen + 1);
for(i = bars - NST_period - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNST - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNST = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
if(i < bars - NST_period - 1 - 3*SmLen)
{
if(maNST > 85) NST = MathRound(85 + (maNST - 85) / 2);
else if(maNST < -85) NST = MathRound(-85 - (MathAbs(maNST) - 85) / 2);
else NST = MathRound(maNST);
}
}

return(0);
}


int IntPortion(double param)
{
if (param > 0) return (MathFloor (param));
if (param < 0) return (MathCeil (param));
return (0);
}

//----------------------------------------------------------------------------------------------

//----------#2 indicator nxc

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Magenta
#property indicator_color2 Lime
#property indicator_level1 -50
#property indicator_level2 0
#property indicator_level3 50
#property indicator_levelcolor Gray
#property indicator_levelstyle 2
#property indicator_minimum -100
#property indicator_maximum 100

extern int NDX_period = 40;
extern int NDX_SmLen = 20;
extern int NST_period = 20;
extern int NST_SmLen = 10;


static datetime lastcalctime;

double NXC[];
double ZH[];
double RawNDX[];
double RawNST[];

double maNDX[];
double maNST[];

double fC0Buffer[];
double fA8Buffer[];
double fC8Buffer[];
double list[128], ring1[128], ring2[11], buffer[62];
bool initFlag;
int limitValue, startValue, loopParam, loopCriteria;
int cycleLimit, highLimit, counterA, counterB;
double cycleDelta, lowDValue, highDValue, absValue, paramA, paramB;
double phaseParam, logParam, JMAValue, series, sValue, sqrtParam, lengthDivider;
int s58, s60, s40, s38, s68;

int init()
{
if(NDX_SmLen < 10) NDX_SmLen = 10;
else if(NDX_SmLen > 30) NDX_SmLen = 30;
if(NST_SmLen < 5) NST_SmLen = 5;
else if(NST_SmLen > 15) NST_SmLen = 15;
string nxcname = "NXC(" + NDX_period + ", " + NDX_SmLen + ", " +
NST_period + ", " + NST_SmLen + ")";

IndicatorShortName(nxcname);
IndicatorDigits(0);
IndicatorBuffers(4);
SetIndexBuffer(0, NXC);
SetIndexLabel(0, nxcname);
SetIndexBuffer(1, ZH);
SetIndexLabel(1, "NXC_ZH");
SetIndexStyle(1, DRAW_ARROW);
SetIndexArrow(1, ZH_symbol);
SetIndexBuffer(2, RawNDX);
SetIndexBuffer(3, RawNST);
return(0);
}

int start()
{

double ExpSmooth, XAvg1, XAvg2, XAvg3, avg, sign;

if(MaxBars > 0) { bars = MaxBars; if(counted_bars > bars) counted_bars = bars - 2; } else bars = Bars;
int start = 3*MathMax(NDX_SmLen, NST_SmLen);

if(bars <= MathMax(NDX_period, NST_period) + start) return(0);
if(counted_bars < 0) counted_bars = 0;
if(counted_bars > MathMax(NDX_period, NST_period)) limit = bars - counted_bars;
else limit = bars - MathMax(NDX_period, NST_period) - 1;

for(i = limit; i >= 0; i--)
{
double SumWght = 0, SumDnom = 0, DifAry, DnomAry, FracAry, TimeAry, WghtAry;
for(ii = 1; ii <= NDX_period; ii++)
{
DifAry = MathLog(Close[i+ii-1]) - MathLog(Close[i+ii]);
if(ii == 1) DnomAry = MathAbs(DifAry); else DnomAry += MathAbs(DifAry);
if(DnomAry == 0) FracAry = 0; else FracAry = (MathLog(Close) - MathLog(Close[i+ii])) / DnomAry;
TimeAry = 1 / MathPow(ii, 0.5);
WghtAry = FracAry * TimeAry;
SumWght += WghtAry;
SumDnom += TimeAry;
}
RawNDX = 100 * SumWght / SumDnom;
}

ArrayResize(maNDX, bars - MathMax(NDX_period, NST_period));
ArraySetAsSeries(maNDX, true);
ArrayInitialize(maNDX, 0);

ExpSmooth = 2; XAvg1 = 0; XAvg2 = 0; XAvg3 = 0;
ExpSmooth = ExpSmooth / (NDX_SmLen + 1);
for(i = bars - MathMax(NDX_period, NST_period) - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNDX - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNDX = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
}



for(i = limit; i >= 0; i--)
{
double SumWgt = 0, SumDnm = 0, HghAry, LowAry, RngAry, FrcAry, TmeAry, WgtAry;
for(ii = 0; ii <= NST_period; ii++)
{
if(ii < 2) HghAry = High; else HghAry = High[iHighest(NULL, 0, MODE_HIGH, ii, i)];
if(ii < 2) LowAry = Low; else LowAry = Low[iLowest(NULL, 0, MODE_LOW, ii, i)];
RngAry = HghAry - LowAry;
if(RngAry == 0) FrcAry = 0; else FrcAry = (Close - LowAry) / RngAry;
TmeAry = 1 / MathPow(ii+1, 0.5);
WgtAry = TmeAry * FrcAry;
SumWgt += WgtAry;
SumDnm += TmeAry;
}
RawNST = (200 * SumWgt / SumDnm) - 100;
}

ArrayResize(maNST, bars - MathMax(NDX_period, NST_period));
ArraySetAsSeries(maNST, true);
ArrayInitialize(maNST, 0);

ExpSmooth = 2; XAvg1 = 0; XAvg2 = 0; XAvg3 = 0;
ExpSmooth = ExpSmooth / (NST_SmLen + 1);
for(i = bars - MathMax(NDX_period, NST_period) - 1; i >= 0; i--)
{
XAvg1 += ExpSmooth * (RawNST - XAvg1);
XAvg2 += ExpSmooth * (XAvg1 - XAvg2);
XAvg3 += ExpSmooth * (XAvg2 - XAvg3);
maNST = 3 * XAvg1 - 3 * XAvg2 + XAvg3;
}


for(i = limit; i >= 0; i--)
if(i < bars - MathMax(NDX_period, NST_period) - 1 - start)
{
avg = ((MathAbs(maNDX) * maNST) + (MathAbs(maNST) * maNDX)) / 2;
if(avg > 0) sign = 1;
else if(avg < 0) sign = -1;
else sign = 0;
NXC = MathRound(sign * MathSqrt(MathAbs(avg)));
}

return(0);
}


int IntPortion(double param)
{
if (param > 0) return (MathFloor (param));
if (param < 0) return (MathCeil (param));
return (0);
}
 

ajeetsingh

Well-Known Member
Dear Ajit,
Now only solution is Kelvin or Happy or Amitrandive........etc
Thanks and regards,
Maruti Mane

Seniors, please help
I need an afl to draw automatically Fibo retracement levels of 50%, 38.2%, 23.6% based on yesterday's daily high and low
Till now I draw it manually using amibroker's default draw feature.
I have attached an image in support......
Please help......



 
hi

I trade a simple opening range breakout strategy where you buy if price crosses above the high of first 15 min / 30 min / 60 min range of the stock and viceversa for sell . since i use metastock for charting i do not get the time of day syntax to backtest the best time frame for using the strategy . i am not familiar with amibroker . can someone backtest the strategy in amibroker and confirm by the results which is the best time frame 15 minutes or 30 min or 60 min for trading the strategy for indian f&o stocks
 

Nehal_s143

Well-Known Member
Will have to work on that.

Right Click on Chart
Either Delete Indicator or Delete Pane
Code:
_SECTION_BEGIN("Daily Levels");


// week

WO=  TimeFrameGetPrice("O",inWeekly,-1); 
WH=  TimeFrameGetPrice("H",inWeekly,-1); 
WL=  TimeFrameGetPrice("L",inWeekly,-1);
WC=  TimeFrameGetPrice("C",inWeekly,-1);

// WEEK PIVOT Calculation
pw = ( WH+ WL + WC )/3;
sw1 = (2*pw)-WH;
sw2 = pw -(WH - WL);
sw3 = Sw1 - (WH-WL); 
rw1 = (2*pw)-WL;
rw2 = pw +(WH -WL);
rw3 = rw1 +(WH-WL);

Plot(C,"",31,64);

Plot(rw3,"WR3:",10,1|styleNoRescale);PlotText( "WR3 : "+rw3+"", BarCount+2, LastValue(rw3), 10,1);
Plot(rw2,"WR2:",10,1|styleNoRescale);PlotText( "WR2 : "+rw2+"", BarCount+2, LastValue(rw2), 10,1);
Plot(rw1,"WR1:",10,1|styleNoRescale);PlotText( "WR1 : "+rw1+"", BarCount+2, LastValue(rw1), 10,1);
Plot(pw,"PW",6,8|styleNoRescale);PlotText( "WP : "+pw+"", BarCount+3, LastValue(pw), 6,1);
Plot(sw1,"WS1:",11,1|styleNoRescale);PlotText( "WS1 : "+sw1+"", BarCount+2, LastValue(sw1), 10,1);
Plot(sw2,"WS1:",11,1|styleNoRescale);PlotText( "WS2 : "+sw2+"", BarCount+2, LastValue(sw2), 10,1);
Plot(sw3,"WS1:",11,1|styleNoRescale);PlotText( "WS3 : "+sw3+"", BarCount+2, LastValue(sw3), 10,1);

//month

MO=  TimeFrameGetPrice("O",inMonthly,-1); 
MH=  TimeFrameGetPrice("H",inMonthly,-1); 
ML=  TimeFrameGetPrice("L",inMonthly,-1);
MC=  TimeFrameGetPrice("C",inMonthly,-1);

// MONTH PIVOT Calculation
pm = ( MH+ ML + MC )/3;
sm1 = (2*pm)-MH;
sm2 = pm -(MH - ML);
sm3 = Sm1 - (MH-ML); 
rm1 = (2*pm)-ML;
rm2 = pm +(MH -ML);
rm3 = rm1 +(MH-ML);

Plot(rm3,"MR3:",10,1|styleNoRescale);PlotText( "MR3 : "+rm3+"", BarCount+2, LastValue(rm3), 10,1);
Plot(rm2,"MR2:",10,1|styleNoRescale);PlotText( "MR2 : "+rm2+"", BarCount+2, LastValue(rm2), 10,1);
Plot(rm1,"MR1:",10,1|styleNoRescale);PlotText( "MR1 : "+rm1+"", BarCount+2, LastValue(rm1), 10,1);
Plot(pm,"PM",6,8|styleNoRescale);PlotText( "MP : "+pm+"", BarCount+3, LastValue(pm), 6,1);
Plot(sm1,"MS1:",11,1|styleNoRescale);PlotText( "MS1 : "+sm1+"", BarCount+2, LastValue(sm1), 10,1);
Plot(sm2,"MS2:",11,1|styleNoRescale);PlotText( "MS2 : "+sm2+"", BarCount+2, LastValue(sm2), 10,1);
Plot(sm3,"MS3:",11,1|styleNoRescale);PlotText( "MS3 : "+sm3+"", BarCount+2, LastValue(sm3), 10,1);


_SECTION_END();


_SECTION_BEGIN("Daily Levels");


DayH = TimeFrameGetPrice("H", inDaily, -1);		// yesterdays high
DayL = TimeFrameGetPrice("L", inDaily, -1);		//				low
DayC = TimeFrameGetPrice("C", inDaily, -1);		//				close
DayO = TimeFrameGetPrice("O", inDaily);			// current day open
Dayz = TimeFrameGetPrice("C", inDaily, -6);		//		six days close


if ( True )
{
PP = (DayH + DayL + Dayc)/3;
R1  =  (2*PP) - DayL;
S1  =  (2*PP) - DayH;
R2  =  PP + (DayH - DayL);
S2  =  PP - (DayH - DayL);
R3  =  R1 + (DayH - DayL);
S3  =  S1 - (DayH - DayL);
}


// PARAMETERS
SHALD = ParamList("daily Pivots", "selected only|all|hide" );

//day
PDP = ParamList("PP",   "SHOW|HIDE" ); 
PDR1 = ParamList("R1", "SHOW|HIDE" ); 
PDR2 = ParamList("R2", "HIDE|SHOW"  ); 
PDR3 = ParamList("R3", "HIDE|SHOW" ); 

PDS1 = ParamList("S1", "SHOW|HIDE" ); 
PDS2 = ParamList("S2", "HIDE|SHOW" ); 
PDS3 = ParamList("S3", "HIDE|SHOW" ); 

DayCOLOR = 34;

/*--------------------------------------*/
// PLOTS
 style = IIf(ParamList("Chart style",
"styleCandle|styleBar")=="styleCandle",64,128);
 Plot (C,Date ()+" close",11,style);
 //day
 if ((PDP=="SHOW" OR SHALD=="all")  && SHALD!="hide") Plot (pp,"daily Pivot
",DayCOLOR,1);
 if ((PDR1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r1,"daily R1
",DayCOLOR,32);
 if ((PDR2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r2,"daily R2
",DayCOLOR,32);
 if ((PDR3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (r3,"daily R3
",DayCOLOR,32);

 if ((PDS1=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (s1,"daily S1
",DayCOLOR,32);
 if ((PDS2=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (S2,"daily S2
",DayCOLOR,32);
 if ((PDS3=="SHOW" OR SHALD=="all") && SHALD!="hide") Plot (S3,"daily S3
",DayCOLOR,32);




_SECTION_END();
 

Similar threads