0% found this document useful (0 votes)
268 views3 pages

Intraday Opening Range Breakout Sysytem AFL

This document provides a summary of an intraday opening range breakout trading system. The system analyzes 5-minute price data and generates buy signals when the high of the current bar breaks above the high of the opening range, and generates sell signals when the low breaks below the low of the opening range. Positions are held until the stop loss or profit target is hit. Signals are filtered to only allow entries within a certain time period each day and to space out trades over time.

Uploaded by

praneet singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
268 views3 pages

Intraday Opening Range Breakout Sysytem AFL

This document provides a summary of an intraday opening range breakout trading system. The system analyzes 5-minute price data and generates buy signals when the high of the current bar breaks above the high of the opening range, and generates sell signals when the low breaks below the low of the opening range. Positions are held until the stop loss or profit target is hit. Signals are filtered to only allow entries within a certain time period each day and to space out trades over time.

Uploaded by

praneet singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//-----------------------------------------------------//

// Formula Name:
Intraday Opening Range Breakout system
// Author/Uploader: Trading Tuitions
// E-mail:
support@tradingtuitions.com
// Website:
www.tradingtuitions.com
//-----------------------------------------------------function ParamOptimize( pname, defaultval, minv, maxv, step )
{
return Optimize( pname,
Param( pname, defaultval, minv, maxv, step ),
minv, maxv, step );
}
_SECTION_BEGIN("Intraday Opening Range Breakout system");
SetOption( "InitialEquity", 200000);
SetOption("FuturesMode" ,True);
SetOption("MinShares",1);
SetOption("CommissionMode",2);
SetOption("CommissionAmount",50);
SetOption("AccountMargin",10);
SetOption("RefreshWhenCompleted",True);
SetPositionSize(150,spsShares);
SetOption( "AllowPositionShrinking", True );
//--Intraday time frame
TimeFrameSet(in5Minute);
TimeFrameInMinutes = 5;
//--Define all params
EntryBufferPct = ParamOptimize("Entry Buffer %", 0, 0, 2, 0.1);
SLPct = ParamOptimize("SL %", 0.5, 0.5, 2, 0.5);
TargetPct = ParamOptimize("Target %", 3, 0, 3, 0.5);
MaxTarget = 100;
TargetPct = IIf(TargetPct == 0, MaxTarget, TargetPct);
EntryTimeStart = ParamOptimize("Entry Time Start (Minutes)", 55, 5, 120, 5);
EntryBarStart = floor(EntryTimeStart/TimeFrameInMinutes) - 1;
EntryTimeEnd = ParamOptimize("Entry Time End (Minutes)", 70, 10, 300, 10);
EntryBarEnd = floor(EntryTimeEnd/TimeFrameInMinutes) - 1;
EntryBarEnd = IIf(EntryBarEnd < EntryBarStart, EntryBarStart, EntryBarEnd);
//--Plot Price Candle Chart
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Cl
ose %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( Close, "Price", colorWhite, styleCandle );
//--New Day & Time. End Day & Time . End Day & Time is null till end of day 1
NewDay = (Day()!= Ref(Day(), -1)) OR BarIndex() == 0;
printf("\n NewDay : " + NewDay );
EndDay = (Day()!= Ref(Day(), 1));
printf("\n EndDay : " + EndDay );
FirstBarTime = ValueWhen(NewDay,TimeNum(),1);
EndTime = ValueWhen(EndDay,TimeNum(),1);
SquareOffTime = EndTime;
//--Calculate ORB, and SL

HighestOfDay = HighestSince(NewDay,H,1);
LowestOfDay = LowestSince(NewDay,L,1);
ORBH = ValueWhen(NewDay,HighestOfDay ,1) * (1 + (EntryBufferPct/100));
ORBL = ValueWhen(NewDay,LowestOfDay ,1) * (1 - (EntryBufferPct/100));
//--Find Buy, Sell, Short & Cover Signals
BarsSinceNewDay = BarsSince(NewDay);
BuySignal = (H >= ORBH) AND (BarsSinceNewDay > EntryBarStart);
printf("\nBuySignal : " + BuySignal );
ShortSignal = (L <= ORBL) AND (BarsSinceNewDay > EntryBarStart) ;
printf("\nShortSignal : " + ShortSignal );
BarsSinceLastBuySignal = (BarsSince(Ref(BuySignal,-1)) + 1);
BarsSinceLastShortSignal = (BarsSince(Ref(ShortSignal,-1)) + 1);
BarsSinceLastEntrySignal = Min(BarsSinceLastBuySignal, BarsSinceLastShortSignal)
;
BothEntrySignalsNull = IsNull(BarsSinceLastBuySignal) AND IsNull(BarsSinceLastSh
ortSignal); //true for start of Day 1
printf("\n\nBarsSinceNewDay : " + BarsSinceNewDay );
printf("\n BarsSinceLastEntrySignal : " + BarsSinceLastEntrySignal);
Buy = (H >= ORBH) AND (BarsSinceNewDay > EntryBarStart) AND (BarsSinceNewDay <=
EntryBarEnd) AND ((BarsSinceNewDay < BarsSinceLastEntrySignal) OR BothEntrySign
alsNull );
Short = (L <= ORBL) AND (BarsSinceNewDay > EntryBarStart) AND (BarsSinceNewDay
<= EntryBarEnd) AND ((BarsSinceNewDay < BarsSinceLastEntrySignal) OR BothEntrySi
gnalsNull );
BuyPrice = IIf(Buy, Max(ORBH,O), Null);
ShortPrice = IIf(Short, Min(ORBL,Open), Null);
ORBHSL = ValueWhen(BuyPrice,BuyPrice) * (1-(SLPct/100));
ORBLSL = ValueWhen(ShortPrice,ShortPrice) * (1+(SLPct/100));
ORBHTarget = ValueWhen(BuyPrice,BuyPrice) * (1+(TargetPct/100));
ORBLTarget = ValueWhen(ShortPrice,ShortPrice) * (1-(TargetPct/100));
Sell = (L <= ORBHSL) OR (H >= ORBHTarget) OR (TimeNum() > SquareOffTime-1) AND (
BarsSinceNewDay > BarsSinceLastBuySignal);
Cover = (H >= ORBLSL) OR (L <= ORBLTarget) OR (TimeNum() > SquareOffTime-1) AND
(BarsSinceNewDay > BarsSinceLastShortSignal);
SellPrice = IIf(Sell, IIf(H >= ORBHTarget, ORBHTarget, Max(ORBHSL, L)), Null);
CoverPrice = IIf(Cover, IIf(L <= ORBLTarget, ORBLTarget, Min(ORBLSL, H)), Null);
printf("\nBuy : " + Buy );
printf("\nSell : " + Sell );
printf("\nShort : " + Short );
printf("\nCover : " + Cover );
printf("\nORBH : " +
printf("\nORBL : " +
printf("\nBuyPrice :
printf("\nShortPrice

ORBH );
ORBL );
" + BuyPrice );
: " + ShortPrice );

printf("\nORBHSL : "
printf("\nORBLSL : "
printf("\nORBHTarget
printf("\nORBLTarget

+
+
:
:

ORBHSL );
ORBLSL );
" + ORBHTarget );
" + ORBLTarget );

//--Handle if ORB broken both sides on same bar


//--And remove duplicate Sell & Cover signals, since ExRem did not work as neede

d when Buy & Sell on same bar


orbBothSides = IIf(Buy AND Short, 1, 0);
Buy = IIf(orbBothSides AND C <= O, 0, Buy);
Short = IIf(orbBothSides AND C > O, 0, Short);
Sell = IIf(orbBothSides AND C > O AND (L <= ORBHSL), 1, Sell);
Sell = IIf((BarsSince(Buy) < (BarsSince(Ref(Sell,-1))+1)) OR (BarsSince(Buy) AND
IsNull(BarsSince(Ref(Sell,-1)))),Sell,0);
Cover = IIf(orbBothSides AND C <= O AND (H >= ORBLSL), 1, Cover);
Cover = IIf((BarsSince(Short) < (BarsSince(Ref(Cover,-1))+1)) OR (BarsSince(Shor
t) AND IsNull(BarsSince(Ref(Cover,-1)))),Cover,0);
//Plot(IIf(BarsSinceNewDay > BarsSinceLastBuySignal,ORBHSL,NULL),"BuyStopLoss",c
olorRed,styleDashed);
//Plot(IIf(BarsSinceNewDay > BarsSinceLastShortSignal,ORBLSL,NULL),"SellStopLoss
",colorRed,styleDashed);
Plot(ORBH,"",colorBlue,styleDots);
Plot(ORBL,"",colorBlue,styleDots);
/* 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(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, 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);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
//--Restore time frame
TimeFrameRestore();
_SECTION_END();

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy