_SECTION_BEGIN("Price");
GraphXSpace=5;
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
up=4969;
dn=4952;
//Plot(up,"UP Break",5,8);
//Plot(dn,"DN Break",4,8);
_SECTION_END();
// Inside bar
Buysignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));
// 1st and third candles Bull candle
Buysignal2 = (Ref(O,-2) < Ref(C,-2)) AND ( Open < Close);
//2nd Candle bear candle
Buysignal3 = (Ref(O,-1) > Ref(C,-1));
// Buy when inside bar, 1st and 3rd bar green
Buy = Buysignal1 AND Buysignal2 AND Buysignal3 ;
//Condition for plotting Buy if its true
//PlotShapes( IIf( Buy,shapeUpArrow + shapePositionAbove , shapeNone ), colorGreen);
// SHORT TRADE
ShortSignal1 = (Ref(L,-1) >= Ref(L,-2)) AND (Ref(H,-1) <= Ref(H,-2));
// 1st and third candles Bear candle
Shortsignal2 = (Ref(O,-2) > Ref(C,-2)) AND ( Open > Close);
//2nd Candle bull candle
Shortsignal3 = (Ref(O,-1) < Ref(C,-1));
Short = Shortsignal1 AND Shortsignal2 AND Shortsignal3 ;
//PlotShapes( IIf( Short,shapeDownArrow , shapeNone ), colorRed );
PlotShapes(Buy * shapeUpArrow,colorGreen, 0,L, Offset=-10);
PlotShapes(Short * shapeDownArrow,colorRed, 0,H, Offset=-10);
/////////////////////