Trend runner for BANK-NIFTY.

#11
thank you ...

yes we will surely upgrade system ..if it need
one more thing using 100 sma give lots of false signals :thumb:
Hello Zuma

Please keep using what is working for you, i will try to put together and post the AFL for your system, as many seem to be using Amibroker for their charts

Cheers
::thumb::


Code:
_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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

_SECTION_BEGIN("MA");
P 	= 	Param("Periods",60,20,300,10);
m	=	MA(O, P);
Plot(m, "MA", IIf(C > m,colorBlue,colorRed), styleThick | styleLine); 
_SECTION_END();

_SECTION_BEGIN("SuperTrend");
Ft		=	Param("Factor",4,1.2,10,0.1);
Pd		=	Param("ATR Periods",60,10,200,10);
Up		=	(H+L)/2 + (Ft*ATR(Pd));
Dn		=	(H+L)/2 - (Ft*ATR(Pd));
iATR	=	ATR(Pd);
UPT		=	DNT		=	Null;
trend[0]	=	1;
CoT	=	0;
flag	=	flagh	=	0;

for (i = 1; i <BarCount; i++) {
      UPT[i] = Null;
      DNT[i] = Null;
     
      trend[i]=1;
   
      
      if (Close[i]>Up[i-1]) {
         trend[i]=1;
         if (trend[i-1] == -1) CoT = 1;
         
      }
      else if (Close[i]<Dn[i-1]) {
         trend[i]=-1;
         if (trend[i-1] == 1) CoT = 1;
      }
      else if (trend[i-1]==1) {
         trend[i]=1;
         CoT = 0;       
      }
      else if (trend[i-1]==-1) {
         trend[i]=-1;
         CoT = 0;
      }

      if (trend[i]<0 && trend[i-1]>0) {
         flag=1;
      }
      else {
         flag=0;
      }
      
      if (trend[i]>0 && trend[i-1]<0) {
         flagh=1;
      }
      else {
         flagh=0;
      }
      
      if (trend[i]>0 && Dn[i]<Dn[i-1]){
         Dn[i]=Dn[i-1];
		}
      
      if (trend[i]<0 && Up[i]>Up[i-1])
        { Up[i]=Up[i-1];
		}
      
      if (flag==1)
       {  Up[i]=(H[i]+L[i])/2+(Ft*iATR[i]);;
        } 
      if (flagh==1)
        { Dn[i]=(H[i]+L[i])/2-(Ft*iATR[i]);;
         }
      if (trend[i]==1) {
         UPT[i]=Dn[i];
         if (CoT == 1) {
            UPT[i-1] = DNT[i-1];
            CoT = 0;
         }
      }
      else if (trend[i]==-1) {
         DNT[i]=Up[i];
         if (CoT == 1) {
            DNT[i-1] = UPT[i-1];
            CoT = 0;
         }
      }
   } 

Plot(UPT,"UP",colorBlue,styleThick|styleStaircase);
Plot(DNT,"DN",colorRed,styleThick|styleStaircase); 
_SECTION_END();


_SECTION_BEGIN("KH-Fractal");

//-- Created by Kelvinhand
Hn1= Ref(H, -1); 
Hn2= Ref(H, -2); 
Hn3= Ref(H, -3); 
Hn4= Ref(H, -4); 

Ln1= Ref(L, -1); 
Ln2= Ref(L, -2); 
Ln3= Ref(L, -3); 
ln4= Ref(L, -4); 

PH = Hn2 >= Hn1 AND Hn2 >= Hn3 AND Hn2>H AND Hn2>Hn4 /*AND Ln2>Ln3 AND Ln2> Ln1 */AND Hn2>Ln2;
PL = Ln2 <= Ln1 AND Ln2 <= Ln3 AND Ln2<L AND Ln2<Ln4 /*AND Hn2<Hn3 AND Hn2<Hn1 */AND Hn2>Ln2;

PH=Ref(PH,2);
PL=Ref(PL,2); 

PH[BarCount-1]= Null;
PL[BarCount-1]= Null;

PH[BarCount-2]= Null;
PL[BarCount-2]= Null;

PlotShapes(shapeSmallCircle * PL, colorGreen, 0, L, -10);
PlotShapes(shapeSmallCircle * PH, colorRed,   0, H,  10);

PlotShapes(shapeSmallCircle * Ref(PL,-1), colorGreen, 0, Ref(L,-1), -10);
PlotShapes(shapeSmallCircle * Ref(PH,-1), colorRed,   0, Ref(H,-1),  10);

PlotShapes(shapeSmallCircle * Ref(PL,-2), colorGreen, 0, Ref(L,-2), -10);
PlotShapes(shapeSmallCircle * Ref(PH,-2), colorRed,   0, Ref(H,-2),  10);

_SECTION_END();
Code is assembled form the codes already posted on TJ.
Please change the parameters as per the system used in MT4, use the above code only after verification from the Zuma.

Cheers
::thumb::
 
Last edited:
#16
bank nifty bought @ 12900 sl 12800
wait for exit ....
Hello Mr Zuma

With this Trend runner for BANK-NIFTY trading system, on an average how many points you are expecting to make.
if monthly average is not certain, can we say it will make minimum average 700-1000 points on Bank nifty Future on quarterly basis.


Regards
Happy
 

Similar threads