AFL Experts , the below AFL is supposed to explore an opening range breakout , currently when explored the exploration does not return anything but only blank columns
Code:
/* Intraday Open Range Breakout Exploration AFL by GMS
What's the open range breakout system ?
1. it identifies the highest price and lowest price reached since open upto the Start Time,
2. Enter long when Price cross above ORBH (Open Range Breakout High) with a stop loss at ORBL(open Range Breakout Low), once in trade adjust SL as per your risk tollarence level.
3. Enter Short when Price cross below ORBL (open Range Breakout Low) with a stop loss at ORBH((Open Range Breakout High),once in trade adjust SL as per your risk tollarence level.
What is in this AFL?
1) Draws regular Candle chart
2) Set ORB Time as per param
3) Marks "ORB High" Green dotted line, "ORB Low" Red dottend line and additional Black dotted line which is middle of ORBH & ORBL on chart
4) Possible to explore, Exploration results are sorted alphabatically and shows following columns
Column 1 = Script
Column 2 = Date
Column 3 = ORBH - Open Range Breakout High value, Green means already triggered.
Column 4 = ORBL - Open Range Breakout Low value, Red Mean already triggered.
Column 5 = ORB High Breakout gain, that is maximum gain if entered long as per ORBH
Column 6 = ORB Low Breakout gain, that is maiimum gain if short as per ORBL
How to trade?
Once ORBH & ORBL are values are set as per param time, place 2 orders
1) BUY stop loss order if price crosses above ORBH price
2) SELL stop loss order if price crosses below ORBL price.
Please strictly trade with stop loss, ideally for long stop loss = ORBL & for short stop loss = ORBH. Please feel free to adjust stop loss based on your risk tollarence level.
*/
_SECTION_BEGIN("Intraday ORB Exploration");
SetChartOptions( 0, chartShowArrows | chartShowDates );
//("ORB");
BT = ParamTime ("Open Breakout Time", "09:20");
afterbreakout0 = Cross(TimeNum(),BT);
afterbreakout1 = TimeNum()>=BT;
NewDay = Day()!= Ref(Day(), -1);
highestoftheday = HighestSince(newday,H,1);
Lowestoftheday =LowestSince(newday,L,1);
ORBH = ValueWhen(afterbreakout0,highestoftheday,1);
ORBL = ValueWhen(afterbreakout0,lowestoftheday,1);
ORBM = (ORBH + ORBL)/2;
Plot(ORBH,"",colorGreen,styleDots);
Plot(ORBL,"",colorRed,styleDots);
Plot(ORBM, "", colorBlack, styleDots);
Plot ( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
ORBHG=H-ORBH;
ORBLG=ORBl-L;
Filter = ORBH OR ORBL;
AddColumn( ORBH, "C>ORBH", 1.2, colorDefault, IIf(Close>ORBH, colorGreen, IIf(Close>ORBM, colorSeaGreen, colorDefault)));
AddColumn( ORBL, "C<ORBL", 1.2, colorDefault, IIf(Close<ORBL, colorRed, IIf(Close<ORBM, colorOrange, colorDefault)));
AddColumn( ORBHG, "ORB High Breakout Gain", 1.2, colorDefault, IIf(ORBHG>0, colorGreen, colorDefault));
AddColumn( ORBLG, "ORB Low Breakout Gain", 1.2, colorDefault, IIf (ORBLG>0, colorRed, colorDefault));
SetSortColumns(1);