ATR Trailing Stoploss


ATR Trailing Stoploss
ATR Trailing Stoploss

//www.aflcode.com
_SECTION_BEGIN("jajal");

//
//    Traditional pivot points.
//    Thought by some to indicate levels of support
//    and resistance.
//R2 = P + (H - L) = P + (R1 - S1)
//R1 = (P x 2) - L
//P = (H + L + C) / 3
//S1 = (P x 2) - H
//S2 = P - (H - L) = P - (R1 - S1)
P = (H + L + C) / 3;
R1 = (P * 2) - L;
S1 = (P * 2) - H;
R2 = P + (R1 - S1); // P + (H - L)
S2 = P - (R1 - S1); // P - (H - L)
R3 = H + 2*(P - L);
S3 = L - 2*(H - P);
Plot(C,"C",colorWhite,styleCandle);
//    Displace the plot of the pivot points one bar
//    to the right.
//    Pivot points are based on the current bar,
//    but are thought to provide indication of
//    support and resistance for the next bar.
//
Displace=1;
Plot(R3,"R3",colorRed,styleDots|styleNoLine,0,0,Displace);
Plot(R2,"R2",colorRed,styleDots|styleNoLine,0,0,Displace);
Plot(R1,"R1",colorRed,styleDots|styleNoLine,0,0,Displace);
Plot(P,"P",colorBlue,styleStaircase,0,0,Displace);
Plot(S1,"S1",colorGreen,styleDots|styleNoLine,0,0,Displace);
Plot(S2,"S2",colorGreen,styleDots|styleNoLine,0,0,Displace);
Plot(S3,"S3",colorGreen,styleDots|styleNoLine,0,0,Displace);
//Figure 8.5 Pivot Points
_SECTION_END();

Previous
Next Post »