Please find the afl code which checks if current intraday candle closes above or below yesterday's high or low between 9.25-9.30am
//----------------------------------------------------------------------------------------------------
//
// Formula Name: Prev-day High/Low Break trade
// Author/Uploader: Neotrade Analytics Pvt Ltd
// E-mail: [email protected]
// Website www.neotradeanalytics.com
// Algobase algobase.neotradeanalytics.com
//
//This is an attempt to provide a basic trading system AFL. The system is purely imaginary
//AND NOT provided as one that would make money. This is just to provide a guide to learners
//on the common components of writing AFL.
//
//-------------------------Summary of AFL-------------------------------------------------------------
//This AFL produces results Buy/Sell results when current intraday candle closes above or below
//previous day high/low
//----------------------------------------------------------------------------------------------------
_SECTION_BEGIN("Previous day high check");
SetChartBkColor(ParamColor("Outer panel color ",colorLightGrey)); // color of outer border
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", colorBlack, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
Session= TimeNum() >= 092500 AND TimeNum() <= 093000;
prevdayhigh[0] = 0;
prevdaylow[0] = 0;
prevdayhigh = TimeFrameGetPrice( "H", inDaily, -1 );
prevdaylow = TimeFrameGetPrice( "L", inDaily, -1 );
Buy = iif((close>prevdayhigh)&&Session,1,0);
Sell = iif((close < prevdaylow)&&Session,1,0);
//Buy = ExRem(Buy,Sell);
//Sell = ExRem(Sell,Buy);
PlotShapes(IIf(Buy, shapestar, shapeNone),colorGreen,0,L,Offset=-45 );
PlotShapes(IIf(Sell, shapestar, shapeNone),colorRed,0,H,Offset=-45);
_SECTION_END();
Warm Regards,
Vivith Kumar ML
www.neotradeanalytics.com
(Authorized realtime data vendor of NSE and BSE provides realtime datafeeds to Amibroker,Metastock,Ninjatrader,custom programming languages(C,C++,Perl,Java) , API for commercial applications and support auto-trading bridge to Zerodha Pi platform)