Needs Correction To Simple AFL To Buy Nifty If (TodaysOpen +10) & Sell If (TodaysOpen-10)

#1
I tried but giving me false signals
It looks my logic is wrong
If anyone can correct please

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



DayO = TimeFrameGetPrice("O", inDaily, 0);
DayH = TimeFrameGetPrice("H", inDaily, 0);
DayL = TimeFrameGetPrice("L", inDaily, 0);


Buy  =  DayO + 10  ;
Sell  =  DayO  - 10  ;

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);


Plot (DayO, "", colorWhite, styleLine + styleDashed + styleNoRescale);
Plot (DayO - 30, "", colorRed, styleLine + styleDashed + styleNoRescale);
Plot (DayO + 30, "", colorGreen, styleLine + styleDashed + styleNoRescale);


/* Plot Buy and Sell Signal Arrows */
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
 
#3
You can just change this only

Buy = Cross(C,DayO + 10 ) ;
Sell = Cross(DayO - 10 ,C) ;

Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

Thank you so much for ur time. Its giving buy signal when candle closes above 10 points up. Can we do it in a way that as soon as it touches 10 points up or below we get buy/sell signal. Please check my Screenshot explaining issue.
 

Attachments

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

Name:Phone:
Email:City:
State:
Are you a day trader?