Need help to formulate this simple Strategy

#1
Hi All,

Can someone help me to formulate the below strategy.

Entry:
Buy when day Close is above the Resistance Line.
BuyPrice = Day Close Price;
StopLoss = BuyPrice - Average True Range (14)
Target = BuyPrice + (2*Average True Range (14))
Exit:
StopLoss or Target is Triggered.


INDICATOR:
------------

_SECTION_BEGIN("Pivot Levels");
PH= ValueWhen(
(Ref(H,-2) > Ref(H, -4)) AND
(Ref(H,-2) > Ref(H, -3)) AND
(Ref(H,-2) > Ref(H, -1)) AND
(Ref(H,-2) > H), Ref(H,-2));
PL= ValueWhen(
(Ref(L,-2) <= Ref(L, -4)) AND
(Ref(L,-2) <= Ref(L, -3)) AND
(Ref(L,-2) <= Ref(L, -1)) AND
(Ref(L,-2) <= L), Ref(L,-2));
Plot(Ref(PH,2), "UpPivot", ParamColor("UpPivot Color",colorRed), styleLine);
Plot(Ref(PL,2), "DownPivot",ParamColor("DownPivot Color",colorGreen), styleLine);
_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();

_SECTION_BEGIN("Exploration");
Filter = Cross(C,PH);
AddColumn(Close,"Entry Price");
AddColumn(Close - ATR(14),"Stop Price");
AddColumn(Close + ATR(14),"Target 1");
AddColumn(Close + (2*ATR(14)),"Target 2");
_SECTION_END();
 

Similar threads