AFL for INTRADAY PIVOT

MarketSecrets - Learn To Trade Like a Pro

AFL for INTRADAY PIVOT

This is an intraday trading system where you can select the high point and low point based on bars based on which buy, short, sell, cover will happen if an average moves above or below it. the averages can be changed based on optimization done.

Script:

_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() );

Periods = Param(“Periods”, 6, 2, 300, 1, 10 );
Periods1 = Param(“Periods1”, 2, 2, 300, 1, 10 );
Periods2 = Param(“Periods2”, 3, 2, 300, 1, 10 );
Periods3 = Param(“Periods3”, 10, 2, 300, 1, 10 );
Periods4 = Param(“Periods4”, 2, 2, 300, 1, 10 );
THB = Param(“Today Hb”, 1, 1, 300, 1);
TLB = Param(“Today Lb”, 9, 1, 300, 1);
THS = Param(“Today Hs”, 4, 1, 300, 1);
TLS = Param(“Today Ls”, 9, 1, 300, 1);
TRG = Param(“Target %”, 9.6, .1, 300, .1)/100;

YH = TimeFrameGetPrice(“H”, inDaily, -2);
YL = TimeFrameGetPrice(“L”, inDaily, -2);
YC = TimeFrameGetPrice(“C”, inDaily, -2);
YO = TimeFrameGetPrice(“O”, inDaily);
PP = (YH + YL + YC) / 3;
wild = Wilders(C,periods) ;
wild1 = Wilders(C,periods1) ;
wild2 = Wilders(C,periods2) ;
wild3 = Wilders(C,periods3) ;
wild4 = Wilders(C,periods4) ;
YYH = TimeFrameGetPrice(“H”, inDaily, -1);
YYL = TimeFrameGetPrice(“L”, inDaily, -1);
YYC = TimeFrameGetPrice(“C”, inDaily, -1);
YPP = (YYH + YYL + YYC) / 3;

TDH = TimeFrameGetPrice(“H”, inDaily);
TDL = TimeFrameGetPrice(“L”, inDaily);
TDC = TimeFrameGetPrice(“C”, inDaily);
TDO = TimeFrameGetPrice(“O”, inDaily);
TPP = (TDH + TDL + TDC) / 3;
Twild = Wilders(C,periods) ;

PrevPP = ValueWhen(DateNum() != Ref(DateNum(),-1), Ref(pp,-1),1);
SLPeriods = Param(“SLPeriods”, 40, 2, 300, 1, 10 );

Plot( pp,”pp”,colorRed,styleDots,2);
Plot( wild,”wild”,colorWhite,styleLine,2);
Plot( wild1,”wild1″,colorBlue,styleLine,2);
Plot( wild2,”wild2″,colorRed,styleLine,2);
Plot( wild3,”wild3″,colorOrange,styleLine,2);
Plot( wild4,”wild4″,colorPink,styleLine,2);
Plot( Ypp,””,colorBlue,styleLine,2);
Plot(tdo, “”,colorPink,styleDots+styleNoRescale);
Plot( YYH,”YYH”,colorOrange,styleDots,2);
Plot( YYL,”YYL”,colorOrange,styleDots,2);

//diff1 = Param(“Diff”, 1, 0, 100, .1 );
//diff = diff1 < abs(((wild-pp)/pp)*100);

d1 = DateNum() != Ref(DateNum(),-1) ;
d2 = BarsSince(d1==1) ;

th2 = ValueWhen(d2 == thB, HHV(H,thB),1);
tl2 = ValueWhen(d2 == tlB, LLV(L,tlB),1);
th3 = ValueWhen(d2 == thS, HHV(H,thS),1);
tl3 = ValueWhen(d2 == tlS, LLV(L,tlS),1);
tH = ValueWhen(d2 == tlS, H,1);
tL = ValueWhen(d2 == thB, L,1);

//Plot(d2,”d2″,colorYellow,styleLine|styleOwnScale);
Plot(th2,”th2″,colorGreen,styleLine,2);
Plot(tl2,”tl2″,colorYellow,styleLine,2);
Plot(th3,”th3″,colorGreen,styleDots,2);
Plot(tl3,”tl3″,colorYellow,styleDots,2);

//tb = TimeNum()>151500 AND TimeNum() < 152500 AND wild > pp AND PP < tpp;
//ts = TimeNum()>151500 AND TimeNum() < 152500 AND wild < pp AND PP > tpp;
Ob = (wild > th2 AND wild>Ref(wild,-1) AND WILD > PP AND TimeNum() < 110000 AND d2 >= thB AND wild > tdo AND (Cross(wild,th2) OR Cross(wild,tdo) OR Cross(WILD,PP))) OR (wild>tl2 AND wild>Ref(wild,-1) AND WILD > PP AND TimeNum() < 110000 AND d2 >= tLB AND wild > tdo AND (Cross(wild,tl2) OR Cross(wild,tdo) OR Cross(WILD,PP))) OR (Cross(wild1,YYH) AND TimeNum() < 110000 ) OR (C < PP AND C > TH AND d2 >= TLS AND TimeNum() > 110000 AND TimeNum() < 120000 );
OS = (wild4 < tl3 AND wild4<Ref(wild4,-1) AND WILD4 < PP AND TimeNum() < 110000 AND d2 >= tlS AND wild4 < tdo AND (Cross(tl3,wild4) OR Cross(tdo,wild4) OR Cross(PP,WILD4))) OR (wild4<th3 AND wild4<Ref(wild4,-1) AND WILD4 < PP AND TimeNum() < 110000 AND d2 >= tHS AND wild4 < tdo AND (Cross(th3,wild4) OR Cross(tdo,wild4) OR Cross(PP,WILD4))) OR (Cross(yyl,wild1) AND TimeNum() < 110000 ) OR (C > PP AND C < TL AND d2 >= THB AND TimeNum() > 110000 AND TimeNum() < 120000 );
ose = Cross(TH2,WILD2) OR Cross(tl2,wild2) OR Cross(yyh,wild3) OR C < TL3 OR TimeNum() > 1455000 ;
oco = Cross(wild2,TL3) OR Cross(wild2,th3) OR Cross(wild3,yyl) OR C > TH2 OR TimeNum() > 1455000 ;

Buy = ExRem(OB, OS OR OSE OR D2 == 0 ) ;
Sell = ExRem(Ose OR TimeNum() > 150000 , Ob ) ;
Short = ExRem(OS,OB OR OCO OR D2 == 0);
Cover = ExRem(Oco OR TimeNum() > 150000 , Os );

//Plot(Btrg,”oco”,colorWhite,styleLine);
//Plot(Os,”os”,colorRed,styleLine|styleOwnScale);

//Plot( abs(((th-pp)/pp)*100),”diff”,colorGreen,styleNoLine|styleNoLabel|styleOwnScale,2);

PlotShapes(Buy*shapeUpArrow,colorBlue,0,L,-12);
PlotShapes(Sell*shapeCircle,colorBlue,0,H,-12);
PlotShapes(Short*shapeDownArrow,colorYellow,0,H,-22);
PlotShapes(Cover*shapeCircle,colorYellow,0,H,-22);

_SECTION_END();

Download AFL

error: Content is protected !!