Natraj EOD Tech Chart

#11
Natraj Sir ; you didnot answered to my query .
Can you help to plot both VMA (High,9,18) and VMA (low,9,18)

@K3325,
HTML:
_SECTION_BEGIN("vidyahigh");
HSU = Sum( C - Ref( C, -1 ) > 0, 18 );
HSD = Sum( C - Ref( C, -1 ) < 0, 18 );
HMO = 100 * ( HSU - HSD ) / ( HSU + HSD );

AbsHMO=( abs(HMO) )/100;

HSC=2/(9+1);

VIDYAH=AMA(H, HSC*AbsHMO );
Plot( VIDYAH, "VidyaH",colorLime,styleLine );
_SECTION_END();
_SECTION_BEGIN("vidyalow");

LSU = Sum( C - Ref( C, -1 ) > 0, 18 );
LSD = Sum( C - Ref( C, -1 ) < 0, 18 );
LMO = 100 * ( LSU - LSD ) / ( LSU + LSD );

AbsLMO=( abs(LMO) )/100;

LSC=2/(9+1);

VidyaL=AMA(L, LSC*AbsLMO );
Plot( VidyaL, "VidyaL",colorOrange,styleLine );
_SECTION_END();


_SECTION_BEGIN("Price");
Plot( Close, "Price", 4, 64 );
_SECTION_END();
 
#12
Thanks a lot for ur such prompt , quick and helpful reply .
U r one of the genius experts present on this forum .
Always ready to help others .
I pray the experts like u will keep on posting such useful AFLs to help newbees like me .
Again thanks a lot .


:clapping: :clapping: :clapping: :clapping: :clapping:
 

Profittaker

Well-Known Member
#13
This Consists of Day, Weekly & Monthly Pivot Support Resistant Levels.
Some of the interesting addons included are Fibo Levels, ATP, Auto MAvg,
Daily Technical Breakout Levels,Super Trend Buy sell Indicator & switching Bar/candle.
Check out Parameter window.
HTML:
_SECTION_BEGIN("Natraj EOD Tech Chart");
GraphXSpace = 15;
SetBarsRequired(200,0);
SetChartOptions(0,chartShowArrows|chartShowDates);
_SECTION_BEGIN("Controls");
pvk=IIf(ParamList("select type","Daily|NextDay")=="Daily",-1,0);
Dpt = ParamToggle("Plot Day Pivot","Off|On",1);
Wpt = ParamToggle("Plot Week Pivot","Off|On",1);
Mpt = ParamToggle("Plot Month Pivot","Off|On",1);
BSpt = ParamToggle("Plot BS Levels","Off|On",1);
Super=ParamToggle("Super","Off|On",1);
fibs = ParamToggle("Plot Fibs","Off|On",0);
fsma=ParamToggle("Moving Avg","Off|On",0);
AutoMA= ParamToggle("Auto MA","Off|On",0);
Atp=ParamToggle("ATP","Off|On",1);
ADSR=ParamToggle("Advanced SR","Off|On",0);
Cloud=ParamToggle("Cloud","Off|On",1);

_SECTION_END();
_SECTION_BEGIN("Price Movement");

bullish=IIf((PDI(42)>MDI(42)) AND (PDI(14)>MDI(14)),1,0);
bearish=IIf((PDI(42)<MDI(42)) AND (PDI(14)<MDI(14)),1,0);
barcolor= colorBlack;
yello=IIf(((H>Ref(H,1)) AND(H>Ref(H,2)) AND(H>Ref(H,3)) AND(Ref(C,4)>0) AND(L<Ref(L,1)) AND(L<Ref(L,2)) AND(L<Ref(L,3))),1,0);
nocol=IIf(NOT(bullish OR bearish),1,0);
Col=bullish*colorGreen + bearish*colorRed+nocol*colorGrey50;
Colr=IIf(yello,colorYellow,Col);
//col=IIf(state == 1 ,43,IIf(state ==0,4,1));
Plot(C,"",Colr,Param("chart Type",64,64,128,64));

period=Param("Period",34,10,100);
RWH=(High-Ref(Low,-period))/(ATR(period)*sqrt(period));
RWL=(Ref(H,-period)-L)/(ATR(period)*sqrt(period));
Pk=WMA((RWH-RWL),3);
MN=MA(Pk,period);
SD=StDev(Pk,period);
Val1=IIf(MN+(1.33*SD)>2.08,MN+(1.33*SD),2.08);
Val2=IIf(MN-(1.33*SD)<-1.92,MN-(1.33*SD),-1.92);
ln1=IIf(Ref(Pk,-1)>=0 AND Pk>0,Val1,IIf(Ref(Pk,-1)<=0 AND Pk<0,Val2,0));
Red=IIf(Ref(Pk,-1)>Pk,Pk,0);
Green=IIf(Pk>Ref(Pk,-1),Pk,0);

tip=IIf(green>ln1 AND green>1,1,0);
bip=IIf(red<ln1 AND red<-1,1,0);
top=IIf(red>ln1 AND red>1,1,0);
bottom=IIf(green<ln1 AND green<-1,1,0);

printf("\nGreen" + WriteVal(green));
printf("\nRed" + WriteVal(red));
printf("\nLN" + WriteVal(ln1));
printf("\nRWH" + WriteVal(RWH));
printf("\nRWL" + WriteVal(RWL));
printf("\npk" + WriteVal(pk));
printf("\nMN" + WriteVal(MN));
printf("\nSD" + WriteVal(SD));
printf("\nVAL1" + WriteVal(Val1));
printf("\nVAL2" + WriteVal(Val2));

tshape=tip*shapeSmallCircle + bip*shapeSmallCircle + top*shapeCircle + bottom*shapeCircle ;

PlotShapes( tshape, IIf( tip OR top, colorBrightGreen, ColorRGB(230,75,0)), 0, IIf( bip OR bottom, Low, High ),IIf(bip OR bottom,-25,25) );

Prev_Close= TimeFrameGetPrice( "C", inDaily, -1, expandFirst) ;
Plot(prev_close,"Privious Close",colorBlack);
_SECTION_END();

_SECTION_BEGIN("Fib Retracements");
	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);
	hts  = Param ("Text Shift", 1.4,-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(fibs==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();

_SECTION_BEGIN("Super");

Lucky=ATR(5);
revers=3.2 * Lucky;
Trend = 1;  
LTN[0] = 0;  


for(i = 1; i < BarCount; i++)
{
 if(Trend[i-1] == 1)                
 {
  if(L[i] < LTN[i-1])                 
  {
   Trend[i] = -1;                   
   LTN[i] = L[i] + Revers[i];        
  }
  else                              
  {
   Trend[i] = 1;
   if((L[i] - Revers[i]) > LTN[i-1])
   {
    LTN[i] = H[i] - Revers[i]; 
   }
   else
   {
    LTN[i] = LTN[i-1];
   }
  } 
 }
 if(Trend[i-1] == -1)               
 {
  if(H[i] > LTN[i-1])                
  {
   Trend[i] = 1;                    
   LTN[i] = H[i] - Revers[i];        
  }
  else                              
  {
   Trend[i] = -1;
   if((H[i] + Revers[i]) < LTN[i-1]) 
   {
    LTN[i] = L[i] + Revers[i]; 
   }
   else
   {
    LTN[i] = LTN[i-1];
   }
  }
 }
}

//===============system================


TMB=EMA(C,12);
TMS=EMA(C,21);
BC=Cross(H,LTN);
SC=Cross(LTN,L);
BX=SC;	
SX=BC;


Buy= BC AND TMB  > TMS OR  Cross(TMB, TMS) AND EMA(C,1) > LTN OR C > LTN AND TMB > TMS;
Short=SC AND TMB  < TMS OR Cross(TMS, TMB) AND EMA(C,1) < LTN OR C < LTN AND TMB < TMS;
Buy=ExRem(Buy,BX);
BX=ExRem(BX,Buy);
Short=ExRem(Short,SX);
SX=ExRem(SX,Short);
ShortPrice=ValueWhen(Short,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,BX);
Shrt=Flip(Short,SX );

if(Super==1) {
Plot(LTN, "", IIf(Trend == 1, colorBlue,ColorRGB(255,105,21)),styleLine);
shape = SX * shapeHollowCircle + BX * shapeHollowCircle;
PlotShapes( shape, IIf( SX, colorBrightGreen, colorPink ),0, IIf( SX, Low, High ) );

PlotShapes(IIf(Buy, shapeSquare, shapeNone),ColorRGB(10,60,255), 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),ColorRGB(10,50,255), 0,L, Offset=-50);                      
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45); 
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorBrown, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorBrown, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);}

_SECTION_END();

_SECTION_BEGIN("Auto Adjusted MA");

Length=21;
Smooth=5;

Change = C - Ref( C, -1 );
SU = Sum( C - Ref( C, -1 ) > 0, Length );
SD = Sum( C - Ref( C, -1 ) < 0, Length );
CMO = 100 * ( SU - SD ) / ( SU + SD );

AbsCMO=( abs(CMO) )/100;

VSC=2/(Smooth+1);

VIDYA=AMA( C, VSC*AbsCMO );
if(AutoMA==1)
{
Plot( VIDYA, "Vidya",ColorRGB(226,201,208),styleLine);
_SECTION_END();}
_SECTION_BEGIN("pivots mw");
SetChartBkColor(2) ;
k1=-1;
TimeFrameSet(inDaily);
day_h= LastValue(Ref(H,pvk));
day_l= LastValue(Ref(L,pvk));
day_c= LastValue(Ref(C,pvk));
TimeFrameRestore();

TimeFrameSet(inWeekly);
Week_h= LastValue(Ref(H,K1));
Week_l= LastValue(Ref(L,K1));;
Week_c= LastValue(Ref(C,K1));;
TimeFrameRestore();

TimeFrameSet(inMonthly);
month_h= LastValue(Ref(H,K1));
month_l= LastValue(Ref(L,K1));
month_c= LastValue(Ref(C,K1));
TimeFrameRestore();

/*--------------------------------------*/
// day
DH=Day_h;
DL=Day_L;
DC=Day_C;

// DAY PIVOT Calculation
pd = ( DH+ DL + DC )/3;
sd1 = (2*pd)-DH;
sd2 = pd -(DH - DL);
sd3 = Sd1 - (DH-DL); 
sd4 = Sd2 - (DH-DL); 
sd5 = Sd3 - (DH-DL); 
rd1 = (2*pd)-DL;
rd2 = pd +(DH -DL);
rd3 = rd1 +(DH-DL);
rd4 = rd2 +(DH-DL);
rd5 = rd3 +(DH-DL);
dp=pd;
mr1=(pd+rd1)/2; mr1I = LastValue (mr1,1);
ms1=(pd+sd1)/2; ms1I = LastValue (ms1,1);
// week
WH=Week_h;
WL=Week_l;
WC=Week_c;

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


// month
MH=month_h;
ML=month_l;
MC=month_c;

// 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);

ppl = ParamToggle("Plot Pivot Levels","Off|On",1);
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
hts = Param("slide all",33,-1000,1000,1);


{
if(Dpt==1) {
Plot(pd,"",colorGold,styleLine|styleDashed|styleNoRescale);
Plot(sd1,"",ColorRGB(73,123,201),styleDashed|styleNoRescale);
Plot(sd2,"",ColorRGB(73,123,201),styleDashed|styleNoRescale);
Plot(sd3,"",ColorRGB(73,123,201),styleDashed|styleNoRescale);
Plot(sd4,"",ColorRGB(73,123,201),styleDashed|styleNoRescale);
Plot(sd5,"",ColorRGB(73,123,201),styleDashed|styleNoRescale);
Plot(rd1,"",ColorRGB(150,60,39),styleDashed|styleNoRescale);
Plot(rd2,"",ColorRGB(150,60,39),styleDashed|styleNoRescale);
Plot(rd3,"",ColorRGB(150,60,39),styleDashed|styleNoRescale);
Plot(rd4,"",ColorRGB(150,60,39),styleDashed|styleNoRescale);
Plot(rd5,"",ColorRGB(150,60,39),styleDashed|styleNoRescale);}
if(BSpt==1) {
Plot(mr1,"",colorLime,styleDots|styleNoRescale);
Plot(ms1,"",colorOrange,styleDots|styleNoRescale);}
if(Wpt==1) {
Plot(pw,"",colorYellow,styleLine|styleDashed|styleNoRescale);
Plot(sw1,"",ColorRGB(9,128,250), styleDashed|styleNoRescale);
Plot(sw2,"",ColorRGB(9,128,250), styleDashed|styleNoRescale);
Plot(sw3,"",ColorRGB(9,128,250), styleDashed|styleNoRescale);
Plot(sw4,"",ColorRGB(9,128,250), styleDashed|styleNoRescale);
Plot(rw1,"",ColorRGB(207,96,39), styleDashed|styleNoRescale);
Plot(rw2,"",ColorRGB(207,96,39), styleDashed|styleNoRescale);
Plot(rw3,"",ColorRGB(207,96,39), styleDashed|styleNoRescale);
Plot(rw4,"",ColorRGB(207,96,39), styleDashed|styleNoRescale);}

if(Mpt==1) {
Plot(pm,"",colorYellow,styleLine|styleDashed|styleNoRescale);
Plot(sm1,"",colorBrightGreen, styleDashed|styleNoRescale);
Plot(sm2,"",colorBrightGreen, styleDashed|styleNoRescale);
Plot(sm3,"",colorBrightGreen, styleDashed|styleNoRescale);
Plot(rm1,"",ColorRGB(175,96,175), styleDashed|styleNoRescale);
Plot(rm2,"",ColorRGB(175,96,175), styleDashed|styleNoRescale);
Plot(rm3,"",ColorRGB(175,96,175), styleDashed|styleNoRescale);}

i=1;
if(BSpt==1) {
PlotText(" Buy Abv = " + WriteVal(mr1,fraction), LastValue(BarIndex())-(numbars/Hts), mr1 , colorLime);
PlotText(" Sell Blw = " + WriteVal(ms1,fraction), LastValue(BarIndex())-(numbars/Hts), ms1 , colorOrange);}

if(Dpt==1) {
PlotText(" D-PVT = " + WriteVal(pd,fraction), LastValue(BarIndex())-(numbars/Hts), dp, colorGold);
PlotText(" DR1 = " + WriteVal(rd1,fraction), LastValue(BarIndex())-(numbars/Hts), rd1 , ColorRGB(150,60,39));
PlotText(" DS1 = " + WriteVal(sd1,fraction), LastValue(BarIndex())-(numbars/Hts), sd1 , ColorRGB(73,123,201));
PlotText(" DR2 = " + WriteVal(rd2,fraction), LastValue(BarIndex())-(numbars/Hts), rd2 , ColorRGB(150,60,39));
PlotText(" DS2 = " + WriteVal(sd2,fraction), LastValue(BarIndex())-(numbars/Hts), sd2 , ColorRGB(73,123,201));
PlotText(" DR3 = " + WriteVal(rd3,fraction), LastValue(BarIndex())-(numbars/Hts), rd3 , ColorRGB(150,60,39));
PlotText(" DS3 = " + WriteVal(sd3,fraction), LastValue(BarIndex())-(numbars/Hts), sd3 , ColorRGB(73,123,201));
PlotText(" DR4 = " + WriteVal(rd4,fraction), LastValue(BarIndex())-(numbars/Hts), rd4 , ColorRGB(150,60,39));
PlotText(" DS4 = " + WriteVal(sd4,fraction), LastValue(BarIndex())-(numbars/Hts), sd4 , ColorRGB(73,123,201));
PlotText(" DR5 = " + WriteVal(rd4,fraction), LastValue(BarIndex())-(numbars/Hts), rd5 , ColorRGB(150,60,39));
PlotText(" DS5 = " + WriteVal(sd4,fraction), LastValue(BarIndex())-(numbars/Hts), sd5 , ColorRGB(73,123,201));}
if(Wpt==1) {
PlotText(" W-PVT = " + WriteVal(pw,fraction), LastValue(BarIndex())-(numbars/Hts), pw , colorYellow);

PlotText(" WR1 = " + WriteVal(rw1,fraction), LastValue(BarIndex())-(numbars/Hts), rw1 , ColorRGB(207,96,39));
PlotText(" WS1 = " + WriteVal(sw1,fraction), LastValue(BarIndex())-(numbars/Hts), sw1 , ColorRGB(9,128,250));
PlotText(" WR2 = " + WriteVal(rw2,fraction), LastValue(BarIndex())-(numbars/Hts), rw2 , ColorRGB(207,96,39));
PlotText(" WS2 = " + WriteVal(sw2,fraction), LastValue(BarIndex())-(numbars/Hts), sw2 , ColorRGB(9,128,250));
PlotText(" WR3 = " + WriteVal(rw3,fraction), LastValue(BarIndex())-(numbars/Hts), rw3 , ColorRGB(207,96,39));
PlotText(" WS3 = " + WriteVal(sw3,fraction), LastValue(BarIndex())-(numbars/Hts), sw3 , ColorRGB(9,128,250));
PlotText(" WR4 = " + WriteVal(rw4,fraction), LastValue(BarIndex())-(numbars/Hts), rw4 , ColorRGB(207,96,39));
PlotText(" WS4 = " + WriteVal(sw4,fraction), LastValue(BarIndex())-(numbars/Hts), sw4 , ColorRGB(9,128,250));}
if(Mpt==1) {
PlotText(" M-PVT = " + WriteVal(pm,fraction), LastValue(BarIndex())-(numbars/Hts), pm , colorYellow);

PlotText(" MR1 = " + WriteVal(rm1,fraction), LastValue(BarIndex())-(numbars/Hts), rm1 , ColorRGB(175,96,175));
PlotText(" MS1 = " + WriteVal(sm1,fraction), LastValue(BarIndex())-(numbars/Hts), sm1 , colorBrightGreen);
PlotText(" MR2 = " + WriteVal(rm2,fraction), LastValue(BarIndex())-(numbars/Hts), rm2 , ColorRGB(175,96,175));
PlotText(" MS2 = " + WriteVal(sm2,fraction), LastValue(BarIndex())-(numbars/Hts), sm2 , colorBrightGreen);
PlotText(" MR3 = " + WriteVal(rm3,fraction), LastValue(BarIndex())-(numbars/Hts), rm3 , ColorRGB(175,96,175));
PlotText(" MS3 = " + WriteVal(sm3,fraction), LastValue(BarIndex())-(numbars/Hts), sm3 , colorBrightGreen);}

}

//--end---------------------------------------------------------------------------- 
_SECTION_END();

/*--------------------------------------*/
BuyAbv=(pd+rd1)/2;
ShortBl=(pd+sd1)/2;

_SECTION_BEGIN("Scanning Exploration");
Filter = 1;
//AddTextColumn( FullName(), "Company Name" );
AddColumn(pd, "Pivot Point",6.2,1,colorGold);
AddColumn(BuyAbv, "Buy Above",6.2,1,colorLime);
AddColumn(rd1, "R-1",6.2,1,colorGreen);
AddColumn(rd2, "R-2",6.2,1,colorGreen);
AddColumn(rd3, "R-3",6.2,1,colorGreen);
AddColumn(rd4, "R-4",6.2,1,colorGreen);
AddColumn(ShortBl, "Short Below",6.2,1,colorOrange);
AddColumn(sd1, "S-1",6.2,1,colorBrown);
AddColumn(sd2, "S-2",6.2,1,colorBrown);
AddColumn(sd3, "S-3",6.2,1,colorBrown);
AddColumn(sd4, "S-4",6.2,1,colorBrown);

_SECTION_END();

// TEXT
"high  = "+H;
"low   =  "+L;
"close = "+C;

_SECTION_BEGIN("ATP");

DayChange = Day() != Ref(Day(), -1);
AvgTradePrice = Null;
CurDayBars = 0;
CurDayCloseSum = 0;

for (i = 0; i < BarCount; i++)
{
if (DayChange[i])
{
CurDayCloseSum = C[i];
CurDayBars = 1;
}
else
{
CurDayCloseSum = CurDayCloseSum + C[i];
CurDayBars++;
}
AvgTradePrice[i] = CurDayCloseSum / CurDayBars;
}
if(Atp==1)
{
Plot(AvgTradePrice, "AvgTradePrice",colorGrey40,styleDashed);
ATP=AvgTradePrice;

_SECTION_END();}

_SECTION_BEGIN("SAR");
accel = Param("Acceleration", 0.02, 0, 1, 0.001); 
mx = Param("Max. acceleration", 0.2, 0, 1, 0.001); 

F_SAR = SAR(accel,mx); 

colordots = IIf(F_SAR < L,ColorRGB(60,100,60),IIf(F_SAR> H,ColorRGB(100,60,60),colorWhite)); 

SBuy = Cross(C,F_SAR); SBuy = Ref(SBuy,-1); SBuyPrice = O; 
SSell = Cross(F_SAR,C); SSell = Ref(SSell,-1); SSellPrice = O; 
PSAR= ParamToggle("SAR","Off|On",0);
if(PSAR==1){
Plot(F_SAR,"\nF_SAR",colordots,styleDots|styleNoLine);}
SBTREND=F_SAR < L;
SSTREND=F_SAR> H;
Ribbon_kol=IIf( SBTREND, colorGreen, IIf(SSTREND, colorRed,colorDarkGrey));
Plot(1, "ribbon", Ribbon_kol, styleOwnScale| styleArea|
styleNoLabel,-0.5,100);
_SECTION_END();



_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator ) 
(
Title = EncodeColor(colorWhite)+ "Natraj EOD Tech Chart" + " - " +  Name() + " - " + EncodeColor(colorBrightGreen)+ Interval(2) + EncodeColor(colorWhite) +
 "  - " + Date() +" - "+"  "+EncodeColor(colorWhite) +"Op-"+O+"  "+"Hi-"+H+"  "+"Lo-"+L+" "+  
"Cl-"+C+"  "+ "Vol= "+ WriteVal(V)+ "  "+ "OI: "+OI+":: "+EncodeColor(ColorRGB(140,140,140)) + "ATP: "+ATP+"\n" + EncodeColor(ColorRGB(175,90,59)) + "DR1="+rd1+"   "+"DR2="+rd2+"   "+"DR3="+rd3+"   "+"DR4="+rd4+"   "+"DR5="+rd5+"  "+EncodeColor(colorGold) +  "D-Pivot ="+pd+"   "+EncodeColor(colorOrange) + "SL = "+LTN+"\n"+  
EncodeColor(ColorRGB(73,123,201)) + "DS1="+sd1+"   "+"DS2="+sd2+"   "+"DS3="+sd3+"   "+"DS4="+sd4+"   "+"DS5="+sd5+"      "+EncodeColor(ColorRGB(226,201,208)) +  "Auto Adj MA = "+VIDYA+"\n"+
EncodeColor(colorOrange) + "WR1="+rw1+"   "+"WR2="+rw2+"   "+"WR3="+rw3+"   "+"WR4="+rw4+"   "+EncodeColor(colorYellow) + "W-Pivot = "+pw+"\n"+
EncodeColor(ColorRGB(9,128,250)) + "WS1="+sw1+"   "+"WS2="+sw2+"   "+"WS3="+sw3+"   "+"WS4="+sw4+"\n"+
EncodeColor(ColorRGB(175,96,175)) + "MR1="+rm1+"   "+"MR2="+rm2+"   "+"MR3="+rm3+"  "+EncodeColor(colorYellow) +   "M-Pivot = "+pm+"\n"+
EncodeColor(colorBrightGreen)  + "MS1="+sm1+"  "+"MS2="+sm2+"   "+"MS3="+sm3+"");


_SECTION_END();

_SECTION_BEGIN("FS Mavg");
if(fsma==1)
{
Plot( EMA( C, 3),"Fast3", ParamColor("colorfast",ColorRGB(5,255,140)), styleNoLabel,styleDashed);
Plot( EMA(C, 13),"Slow13", ParamColor("colormid",ColorRGB(255,128,128)), styleNoLabel,styleDashed);
}
_SECTION_END();

_SECTION_BEGIN("Cloud Setting");
//Cloud

CloudResColor=ParamColor("CloudResColor",ColorRGB(25,33,25));
CR=EMA(H,34);
CS=EMA(L,34);

if(Cloud == 1)
{
	PlotOHLC( CS, CS, CR,CR, "Band", CloudResColor, styleCloud | styleNoLabel|styleNoTitle); 
}

_SECTION_END();


_SECTION_BEGIN("Advanced SR");

if(ADSR==1)
{

per1=Param ("per1", 0.1,0.1,50,0.10);

per=per1;
x = Cum(1);
s1=L;
s11=H;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 1 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleDots,styleThick);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 1 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleDots,styleThick);
//////////////////////////////////////////////////////////////////////////////////////////////////
perc=per1;
x=BarIndex();xx=SelectedValue(x);
t1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,x)) ;
H1=SelectedValue(ValueWhen(PeakBars(C,perc)==0,C)) ;
t11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, x));
H11=SelectedValue(ValueWhen(TroughBars(C,perc)==0, C));
g=t1>t11;
shape=IIf(g,shapeDownArrow*(x==t1),shapeUpArrow*(x ==t11));
Color=IIf(g,colorRed,colorGreen);
PlotShapes(shape,color);
/////////////////////////////////////////////////////////////////////////////////////////////////

per=per1;

x = Cum(1);
s1=C;
s11=C;
pS = TroughBars( s1, per, 1 ) == 0;
endt= SelectedValue(ValueWhen( pS, x, 1 ));
startt=SelectedValue(ValueWhen( pS, x, 2 ));
dtS =endt-startt;
endS = SelectedValue(ValueWhen( pS, s1, 1 ) );
startS = SelectedValue( ValueWhen( pS, s1, 2 ));
aS = (endS-startS)/dtS;
bS = endS;
trendlineS = aS * ( x -endt ) + bS;
g3= IIf(x>startt-10,trendlineS,-1e10);
Plot(g3,"",colorRed,styleThick);

pR = PeakBars( s11, per, 1 ) == 0;
endt1= SelectedValue(ValueWhen( pR, x, 1 ));
startt1=SelectedValue(ValueWhen( pR, x, 2 ));
dtR =endt1-startt1;
endR = SelectedValue(ValueWhen( pR, s11, 1 ) );
startR = SelectedValue( ValueWhen( pR, s11, 2 ));
aR = (endR-startR)/dtR;
bR = endR;
trendlineR = aR * ( x -endt1 ) + bR;
g4= IIf(x>startT1-10,trendlineR,-1e10);
Plot(g4,"",colorGreen,styleThick);}
_SECTION_END();


_SECTION_BEGIN("Super Display");
if(Super==1) {
Srdec = (Param("Srdecimals",2,0,7,1)/10)+1;
SrDisH=(Param("SrDisH",100,0,582,1));
SDW=(Param("SDW",0,0,582,1));
GfxSetOverlayMode( mode = 0 ); 
GfxSelectPen( ColorRGB(99,69,55), 1 ); 
GfxSelectSolidBrush(ColorRGB(23,25,23)); 
GfxRoundRect( 2+SDW,0+SrDisH,169+SDW,55+SrDisH, 15, 15 ); 
GfxSetBkMode(1); 
GfxSelectFont( "Times New Roman",9, 700, False );
GfxSetTextAlign(0);
GfxSetTextColor( colorRed);
GfxTextOut( WriteIf(Long AND NOT Buy, "Long StopLoss: "+WriteVal(LTN,Srdec),""),8+SDW,5+SrDish);
GfxSetTextColor(ColorRGB(0,204,0));
GfxTextOut( WriteIf(shrt AND NOT Short, "Short StopLoss: "+WriteVal(LTN,Srdec ),""),8+SDW,5+SrDish);
GfxSetTextColor(colorGreen);
GfxTextOut( WriteIf(Buy , "Go Long = "+WriteVal(C,Srdec),""), 8+SDW, 20+SrDisH);
GfxSetTextColor(colorRed);
GfxTextOut( WriteIf(Short , "Go Short = "+WriteVal(C,Srdec),""),8+SDW, 20+SrDisH);
GfxSetTextColor( colorGreen);
GfxTextOut( WriteIf( Long AND NOT Buy, "Buy Entry @  = "+WriteVal(BuyPrice,Srdec),""),8+SDW, 20+SrDisH);
GfxSetTextColor(colorRed);
GfxTextOut( WriteIf( shrt AND NOT Short, "Sell Entry @ = "+WriteVal(ShortPrice,Srdec ),""),8+SDW, 20+SrDisH);
GfxSetTextColor(colorLime);
GfxTextOut( WriteIf(BX , "Booked Buy Profit =  "+WriteVal(C-BuyPrice,Srdec),""),8+SDW, 35+SrDisH);
GfxSetTextColor(colorRed);
GfxTextOut( WriteIf(SX , "Booked Short Profit =  "+WriteVal(ShortPrice-C,Srdec),""),8+SDW, 35+SrDisH);
GfxSetTextColor( colorGold);
GfxTextOut( WriteIf( Long AND NOT Buy, "Buy Profit      = "+WriteVal(C-BuyPrice,Srdec ),""),8+SDW, 35+SrDisH);
GfxTextOut( WriteIf( shrt AND NOT Short, "Sell Profit     = "+WriteVal(ShortPrice-C,Srdec ),""),8+SDW, 35+SrDisH);}
_SECTION_END();

_SECTION_BEGIN("Tech Sys");
if(BSpt==1) {
ATSdec = (Param("ATSdecimals",2,0,7,1)/10)+1;
ATSDisH=(Param("ATSDisH",500,0,582,1));
ATSW=(Param("ATSW",0,0,582,1));
GfxSetOverlayMode( mode = 0 ); 
GfxSelectPen( colorGrey50, 1 ); 
GfxSelectSolidBrush(ColorRGB(23,25,23)); 
GfxRoundRect( 2+ATSW, 0+ATSDisH,275+ATSW,75+ATSDisH,15,15); 
GfxSetBkMode(1); 
GfxSelectFont( "Tahoma", 10, 700, False );
GfxSetTextAlign(0);
GfxSetTextColor(colorLime);
GfxTextOut( WriteIf(mr1 , "Buy Above = "+WriteVal(mr1,ATSDec),""),8+ATSW, 5+ATSDisH);
GfxSetTextColor(colorWhite);
GfxTextOut("Target:"+WriteVal(rd1,ATSDec)+" |"+WriteVal(rd2,ATSDec)+" |"+WriteVal(rd3,ATSDec),8+ATSW,20+ATSDisH);
GfxSetTextColor(colorOrange);
GfxTextOut( WriteIf(ms1 , "Short Sell Below = "+WriteVal(ms1,ATSdec),""), 8+ATSW, 35+ATSDisH);
GfxSetTextColor(colorWhite);
GfxTextOut("Target:"+WriteVal(sd1,ATSDec)+" |"+WriteVal(sd2,ATSDec)+" |"+WriteVal(sd3,ATSDec),8+ATSW,50+ATSDisH);
}
_SECTION_END();


_SECTION_BEGIN("Background Color");
BKswitch = ParamToggle("Background Color","On,Off");

OUTcolor = ParamColor("Outer Panel Color",ColorRGB(25,25,25));
INUPcolor = ParamColor("Inner Panel Upper",ColorRGB(23,25,23));
INDNcolor = ParamColor("Inner Panel Lower",ColorRGB(23,25,23));
TitleColor = ParamColor("Title Color ",ColorRGB(23,25,23));

if (NOT BKswitch)
{
SetChartBkColor(OUTcolor); // color of outer border
SetChartBkGradientFill(INUPcolor,INDNcolor,TitleColor); // color of inner panel
}
_SECTION_END();
Dear esnataraj sir,
Can i do backtest this AFL?. If yes Can you help to this?
 
#17
Dear Natraj sir
I saw one of your updated chart of Nickel on some other forum .
In this chart we can see buy above / sell below levels with target 1 & 2 ,
along with SL, and
also one of the interesting thing is "strong buy above this level" .
Both of these interesting things are missing in your submitted AFL.
It shall be of great help if you post this updated AFL.
 
Last edited:

Similar threads