Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

ORB System for Amibroker (AFL)
arian
about 13 years ago
Amibroker (AFL)

Rating:
3 / 5 (Votes 7)
Tags:
trading system, amibroker

this is a simple intraday ORB system. ORB stands for Opening range break-out.

We decide on a period to watch – it could be the first 5, 10, 15, 30, 60 minutes – anything that you decide. Assuming that we decide that the opening range period is 10 minutes. At the end of 10 minutes, place a Buy Stop Loss order at the day’s high(filter), and a Sell Stop Loss order at the day’s low(filter). The filter need not be a big number, otherwise you could lose some part of a good move.

If the Buy Stop Loss gets triggered, you could either decide to leave the the Sell Stop Loss unchanged or modify it to a fixed percentage or a trailing Stop Loss. It is up to you to decide on the stock, filter, and method of Stop Loss once you are in position.

The premise is that we make the most profits during trending days. Generally, on trending days, the Open and Close are at near the extreme ends of the daily range, with minor pullbacks. So once you are in position, if you set your Stop Loss to avoid pullbacks, then you would get the most of a trending day with less risk. The key here is to decide on the Stop Loss. The Stop Loss will vary from stock to stock and period to period. The AFL will help you backtest and decide on the Stop Loss.

With whatever backtest I have done, the maximum returns were when there was no stop loss. Obviously, that is more risky, and I never trade without a Stop Loss.

This is not something new that I discovered. You will find so many ORB systems on the internet. What I want to share is that I have been profitably trading this system successfully for many years now – on NIFTY and recently on Bank Nifty. (Sometimes there have also been very serious whipsaws as well).

This is an Intraday method that does not require any charts. You just need to know the day’s high and low at the end of the opening range period. You also do not need any AFL, except for backtesting.

i found this formula at:
http://www.traderji.com/amibroker/52959-augubhais-orb-system.html

Similar Indicators / Formulas

All in One
Submitted by Nahid almost 14 years ago
Kase Peak Osc. V2 batu
Submitted by batu1453 over 10 years ago
Kase CD V2batu
Submitted by batu1453 over 10 years ago
Ichimoku
Submitted by prashantrdx over 10 years ago
Arvind' System
Submitted by akdabc over 14 years ago
Miftha remix for dse
Submitted by coolpace over 14 years ago

Indicator / Formula

Copy & Paste Friendly
function ParamOptimize( pname, defaultval, minv, maxv, step ) 
{ 
return Optimize( pname, 
Param( pname, defaultval, minv, maxv, step ), 
minv, maxv, step ); 
} 




//_SECTION_BEGIN("Augubhai's ORB System");  

//--Intraday time frame  
TimeFrameSet(in5Minute); //If reseting, check formula for TimeFrameInMinutes  
TimeFrameInMinutes = 5; 

//--Define all params  
EntryBufferPct = ParamOptimize("Entry Buffer %", 0, 0, 2, 0.1); 
SLPct = ParamOptimize("SL %", 1.4, 0.1, 10, 0.1); 
TargetPct = ParamOptimize("Target %", 0, 0, 20, 0.5); 
MaxTarget = 100; 
TargetPct = IIf(TargetPct == 0, MaxTarget, TargetPct);  
EntryTimeStart = ParamOptimize("Entry Time Start (Minutes)", 5, 5, 120, 5); 
EntryBarStart = floor(EntryTimeStart/TimeFrameInMinutes) - 1; 
EntryTimeEnd = ParamOptimize("Entry Time End (Minutes)", 25, 10, 180, 5); 
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, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) )); 
Plot( C, "Close", colorBlack, styleNoTitle | GetPriceStyle() );  

//--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));  
ORBHSL = ORBH * (1-(SLPct/100));  
//ORBHSL = ORBL;  
ORBLSL = ORBL * (1+(SLPct/100)); 
//ORBLSL = ORBH;  
ORBHTarget = ORBH * (1+(TargetPct/100)); 
ORBLTarget = ORBL * (1-(TargetPct/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(BarsSinceLastShortSignal); //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 BothEntrySignalsNull );  
Sell = (L <= ORBHSL) OR (H >= ORBHTarget) OR (TimeNum() > SquareOffTime-1) AND (BarsSinceNewDay > BarsSinceLastBuySignal);  
Short = (L <= ORBL) AND (BarsSinceNewDay  > EntryBarStart) AND (BarsSinceNewDay <= EntryBarEnd) AND ((BarsSinceNewDay < BarsSinceLastEntrySignal) OR BothEntrySignalsNull );  
Cover = (H >= ORBLSL) OR (L <= ORBLTarget) OR (TimeNum() > SquareOffTime-1) AND (BarsSinceNewDay > BarsSinceLastShortSignal);  
printf("\nBuy : " + Buy );  
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  

//--Handle if ORB broken both sides on same bar 
//--And remove duplicate Sell & Cover signals, since ExRem did not work as needed 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(Short) AND IsNull(BarsSince(Ref(Cover,-1)))),Cover,0); 
printf("\n\norbBothSides : " + orbBothSides);  
printf("\nBuy : " + Buy );  
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  

//--Special Condition for 18 & 19 May 2009 
Buy =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Buy ); 
Sell =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Sell ); 
Short =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Short ); 
Cover =IIf(DateNum()==1090518 OR (DateNum()==1090519 AND NewDay),0,Cover ); 

//--Set prices 
BuyPrice = IIf(Buy, ORBH, Null);  
SellPrice = IIf(Sell, IIf(H >= ORBHTarget, ORBHTarget, Max(ORBHSL, L)), Null);  
ShortPrice = IIf(Short, ORBL, Null);  
CoverPrice = IIf(Cover, IIf(L <= ORBLTarget, ORBLTarget, Min(ORBLSL, H)), Null);  

//--Plot ORB, and SL  
Plot(ORBHSL,"",colorRed,styleDashed);  
Plot(ORBLSL,"",colorRed,styleDashed);  
Plot(IIf(TargetPct == MaxTarget, Null, ORBHTarget),"",colorGreen,styleDashed); 
Plot(IIf(TargetPct == MaxTarget, Null, ORBLTarget),"",colorGreen,styleDashed); 
PlotOHLC( ORBL, ORBH, ORBL, ORBH, "", colorYellow, styleCloud);  
  
//--Plot Signals 
shape1 = Buy * shapeUpArrow + Sell * shapeDownArrow;  
PlotShapes( shape1, IIf( Buy, colorGreen, colorGreen), 0, IIf( Buy, Low, High ) );  
shape2 = Cover * shapeUpArrow + Short * shapeDownArrow;  
PlotShapes( shape2, IIf( Cover, colorRed, colorRed), 0, IIf( Cover, Low, High ) );  
GraphXSpace = 5;  

//--Restore time frame  
TimeFrameRestore();  
_SECTION_END();  

3 comments

1. shivaprasadmb

Well, this is a good system with discipline in built into trading. What is also important is to understand what kind of a trading that will be presented which can only be said after looking at first 1 hour of trade.one can use this system along with Market profile or VWAP & its band to see what kind of a day is developing, i am happy to know that you are getting good results and i believe is that you use your experience and mixing the market sentiment along with this trading system.All the best.

2. mahaboobbasha81

Nice afl

3. SADAI

Very good AFL. You are able to modify by various time period for good result

Leave Comment

Please login here to leave a comment.

Back