High Breakout Strategy

#1
Hi ,
Below is my code generates a buy signal if Previous Day High is crossed.

Code:
_SECTION_BEGIN("LongHighBreakout");

lastDayHigh = TimeFrameGetPrice( "H", inDaily, -1 );
todaysOpen = TimeFrameGetPrice("O",inDaily,0);
cond1 = C < MA(C,13);
cond2 = C < MA(C,50);
cond3 = Ref( L, -1 ) > lastDayHigh;

Plot(lastDayHigh,"Prev-High",colorGreen,styleDashed);

Buy = cond1 AND cond2 AND cond3 ;
Sell = False OR TimeNum() > 151500;


ApplyStop(stopTypeLoss,stopModePoint,lastDayHigh[0]);
ApplyStop(stopTypeProfit,stopModePercent,1);


PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorGreen);
PlotShapes(IIf(Sell, shapeDownArrow , shapeNone), colorRed);

_SECTION_END();
 

Attachments

#3
System is not generating Buy Signal

_SECTION_BEGIN("LongHighBreakout");
SetBarsRequired(-2,-2); //Turn Quick AFL Off
SetChartOptions(1,chartShowArrows|chartShowDates);
lastDayHigh = TimeFrameGetPrice( "H", inDaily, -1 );
lastDaylow = TimeFrameGetPrice( "L", inDaily, -1 );


todaysOpen = TimeFrameGetPrice("O",inDaily,0);
cond1 = C < MA(C,13);
cond2 = C < MA(C,50);
cond3 = Ref( L, -1 ) > lastDayHigh;

Plot(lastDayHigh,"Prev-High",colorGreen,styleDots);
Plot(lastDaylow,"Prev-low",colorred,styleDots);

RSI8 =RSI(8);
Colorpetd = IIf(RSI8>50,colorBrightGreen,colorRed);
Plot( C, "Close RSI 8 AND 50", COLORPETD, styleBar, Null, Null, 0, 1, 4 );//5% THICKNESS OF BAR-SEE LAST 4
Buy = cond1 AND cond2 AND cond3 ;
Sell = False OR TimeNum() > 151500;


ApplyStop(stopTypeLoss,stopModePoint,lastDayHigh[0]);
ApplyStop(stopTypeProfit,stopModePercent,1);


PlotShapes(IIf(Buy, shapeUpArrow , shapeNone), colorGreen);
PlotShapes(IIf(Sell, shapeDownArrow , shapeNone), colorRed);

_SECTION_END();
 

Similar threads