ORB Automated Trading Bot

Opening Range Breakout (ORB) is a commonly used trading system by professional and amateur traders alike and has the potential to deliver good returns if done with proper discipline and money management rules. This system is applicable only for intraday trading.

Trading Strategy

Quite Simple and straightforward. Rules in the next section needs to be adhered to increase the success rates dramatically.

Any stock creates a range in the first 10 to 30 minutes of trading in a day. This is calling Opening Range. The highs and lows of this time frame is taken as support and resistance.

  1. Buy when the stock moves above the Opening Range high.
  2. Sell when the stock moves below the Opening Range low.

General Rules — Applicable for both Buy and Sell:

Opening range is defined by the high and low made in the first 15 minutes. You can set the duration as per your wish, it could be either first 5 mins range, 10 minutes range or 15 mins range.

Rules for Buy

Buy when the stock price crosses above the opening range
Initial Stop loss — Low of the Opening Range.

Rules for Sell

Sell when the stock price crosses below the opening range.
Initial Stop loss — High of the Opening Range.
Risk Management

This is how most traders think:

image

They first think about the Entry point, at which price should I buy? At which level should I enter? At which point should I get into a trade?

But this is how you must think to be a profitable trader.

image

You have adapt to trading strategy that suits your psychology, assign trade management rules, keep position sizing and money management rules.

One of the main reason people lose money in stock market is because of their position size.

Consider the following example:

Vicky starts trading with a capital of Rs. 1,00,000 and he finds a trading opportunity and buys Spice Jet share for Rs. 100. At the max, he can buy 1000 shares of Spice Jet stock.

Now if the stock gains 110 in few days, he will gain 10*1000=10,000. That is 10% of his capital. He sells all his 1000 shares, making 10% returns in short span, makes him more happy and wants to try his luck again.
image

Consider if he makes an purchase again of 1000 shares at 100, what if the stock goes down to 90 from 100? He will lose 10% of his capital in short span of time, but he may hold the stock and if continues to slide 90, 85, 80. He panics and sell all his shares at 80, losing 20% of his capital.

**What made Vicky panic? Spice Jet stock falling from 100 to 80? **
No. Its 1000 shares that he bought made him panic.

Imagine, if he had 100 shares. Stock falling from 100 to 80, results in 2000 loss. Which is just 2% of his capital. In this situation, Vicky might be in a better position to make wise decision.

So next time you buy a stock and want to know how many shares you need to buy, follow the below rules.

A. Capital:Rs. 10,000

B. Entry Price of your stock: Rs.100

C. Stop loss: Rs.90

D. Risk: Rs.10

E. We should risk only 2% of capital: 2% of 10,000=Rs.200

So if the trade goes wrong, we will lose only 2% of capital.

F. No of shares: Rs.200/Risk (formula= E/D)

image

So when you buy 20 shares, if the trade goes against us and hits stop loss, we will lose 20*10=Rs. 200 only which is just 2% of the capital.

Quantity:

It should be decided based on the risk per trade, say if our capital is Rs.10,000 and I want to risk 1% of my capital in each trade, then it should be 1% on 10k, which is Rs.100. So 100 Rs is what am going to risk in each trade, accordingly my quantity will be decided.

Quantity = Buy Range — Sell Range. For example, by 9:30 AM, say Reliance High is 1000 and low is 980, then the risk here is 1000–980 =20.

So it should my risk capital/risk, 100/20= 5. Quantity should be 5.

Stock Selection:

The stock selection is most important for the ORB strategy, so we follow a different approach for that, which we explained it in our free webinar.

Trading Bot

Earlier we mentioned in our Telegram channel that we will introduce a new trading bot. As many traders are widely using the Opening Range breakout system, we created a bot which would take your input(capital) and send you the alert at 9:30, so that you can place the orders at the click of a button.

Entry window for the bot will be opened between 8:45 am to 9.10 am, the bot will collect the user input upto this time and by 9:30 am, it will trigger the alert to the individual users.

With this bot, there is no manual intervention at all. Based on the builtin logic of our algorithm, it would automatically choose 5 stocks to trade daily with both Buy & Sell triggers with default risk of 1% per trade. All you have to do is just enter your capital and Target you want to keep for each stock. That’s it.

It would automatically generate execution button for Zerodha & Upstox clients. Just click it to place the trades at 9:30 AM, which will place entry, stoploss and target for you. No need of manual monitoring, with a click of a button, your work gets over in seconds. You can use your existing Zerodha/Upstox accounts, no need of opening new account.

Here’s how the bot works

Open Telegram and enter the bot name **@ORB_squareoff_bo**t click on START

image

Once you start, enter your capital and target, in this format. 10000;3 which denotes Rs.10000 capital and 3% target per trade. In the below example, I have entered 150000;2 which means that my capital is Rs.1.5 Lacs and Target is 2% for every trade. I will get a message confirmation from bot that my details are updated.

image

And then the bot would send you the button to execute the orders by 09:10 AM. The execution buttons will be enabled after 9:30 AM only, so after 9:30AM , just click the button to execute the orders.

image

Then you get the following window, click on Trade to place the trades in your Zerodha account.

Now all the orders are ready and you just have to click on place. Then all these orders gets placed in your zerodha account.

When any orders are executed, automatically Stop loss and Target will be placed as its a Bracket order. Also margin blocked will be minimal due to our position sizing rules. Also all orders limit orders not market orders,to avoid slippages. So only the orders are filled its going to be executed, in case stock jumps suddenly then there is a good chance our order might not be filled. In that case, it will be pending state, you can just leave it, no need to modify. And make sure you manually exit all open orders before 3:20 PM to avoid penalty charges by Zerodha.

3 Likes

Nice… Very cool idea of making a Telegram bot employing the ORB strategy… :+1::+1::+1::+1:

1 Like

Would you do a live webinar to demonstrate the performance and to field questions?

Yes, will conduct one soon.

This is today’s ORB Trading Bot’s result for One lac capital. Will track its performance on a daily basis this month, just to convey how with good risk management rules, any normal trading system can be used to make good and consistent profits.

Hi @KirubaKaran,
I have used this bot today and I have below feedback/questions to you.

  • I used this bot from telegram mobile app and when it opens the order page in chrome browser,the trade button for zerodha didnt appear for atleast 1 minute or more .I had to refresh multiple times to see the trade button.I was on high speed wifi while placing the orders.Can this be looked into & optmized if any one else also faced same issue…

  • I see that trailing stop loss is not enabled for this BO orders.can this be enabled as an option for users and can we have backtest results for the same?

  • Does this bot take leverage into consideration?

Thanks,
Sudheer

Hi Sudheer,

Its browsed based, so it doesn’t connect through mobile app. And its takes 30-60 seconds after 9.30 to get the button updated, so you can directly the click link at 9.31 and place the trade.

TSL will be enabled in the future.

Bot considers only your capital and accordingly generates the quantity.

And the consistent performance of the ORB continues/

Hi @KirubaKaran,
I have used this bot and I have below feedback/questions to you.

  1. Can you backtest accuracy for 0.2%, 0.3% and 0.5% as target for the orb bot?
  2. Can you add a feature like whenever 50% of target is reached cash out 50% and remaining for risk for the target, and check the backtesting results for the same?
1 Like

Hi,

I have taken trialed today with 500 capital, According to ORB strategy order for ONGC was hit at 9.50 am today buy was at 139 but but not why the trade didnot get reversed and the stoploss was hit at 135 , it is 3% loss. which is not ideal.

Hi

With regards to our ORB Trading bot , it is best to ride the trend and close the positions by EOD instead of keeping smaller targets, as this will end up in higher profits in longer run. Also, scale in/scale out doesn’t help much, its wise to go all in and all out to make higher profits and that what the live performance also suggest. You can track the live performance here.

https://goo.gl/HhrK77

We have upgraded our Intraday Opening Range Breakout trading bot with new options. Now user can also have their own choice of stocks as well. You dont need Amibroker, no data feed, no api, no vps, still you can trade ORB with your choice of stocks from Telegram app.

Choosing Square Off Stocks:

List of stocks that comes in Square Off stocks are picked up our own algorithm based on gap analysis, where it picks up list of stocks that has gaped up and gap down.

Gap up stocks are mapped to Top 5 Momentum stocks

Gap down stocks are mapped to Bottom 5 momentum stocks

If users wants to trade both gap up and gap down stocks in one click, they can use the below button

Once you have selected it, you will get two different Risk Management options.

Input Parameters:

Capital;Target;Risk;Order Type;TSL

10000;10;1;M;1 denotes 10000 capital with 10% target, 1% risk per trade, order type is stop loss market order and 1% Trailing Stop loss.

10000;10;1;L;1 denotes 10000 capital with 10% target, 1% risk per trade, order type is stop loss LIMIT order and 1% Trailing Stop loss.

R1: Risk Management Type 1

The default risk per trade is always 1% on capital, not on stock price. Risk % can be changed. No matter whats your capital or Target, maximum risk is always going to be 1%. For example, if your capital is 10000 and target 2%, it means that whenever any of trade reaches Rs.200 (which is 2% profit target), it will exit from the trade automatically or else if the loss is Rs.100 (which is 1% of your capital), it will exit automatically. Please note, the target % and risk % is always based on capital only, not based on stock price. When a stock price moves 2%, it is not called as target, only when that trade makes profit of 2% on capital, it will be considered as target achieved.

Quantity will be decided based on the risk per trade, say if our capital is Rs.10,000 and default risk is 1% of my capital in each trade, then it should be 1% on 10k, which is Rs.100. So 100 Rs is what am going to risk in each trade, accordingly my quantity will be decided.

Quantity = Buy Range — Sell Range. For example, by 9:30 AM, say Reliance High is 1000 and low is 980, then the risk here is 1000–980 =20.

So it should be, my risk capital/risk, 100/20= 5. Quantity should be 5.

More info here

FAQs on ORB Trading Bot
Here’s the list of some of Frequently asked questions related to Squareoff’s ORB Trading bot. medium.com

R2: Risk Management Type 2

This is based on stock price. I have entered capital as 1 lac, with risk per trade as 1%, target 1% with limit order and TSL as 1%

Risk Management 2

So when I try to place the order with R2 as risk management, you can see my quantity is 711 for PCJ, how quantity is calculated here? We allocate our full capital to each stock, my capital is 1 lac and my entry price is Rs.140.6, so quantity is 100000/140.6= 711 quantity.

As I have given 1% as target, stop loss, tsl, 1% of Rs.140.6 (stock entry price) which is equal to 1.4 and that what is seen in above image. So what ever the input we give, target, stop loss, TSL in R2 is based on stock price.

How is it different from the old risk management rule R1?

In our earlier version, the stop loss is always based on ORB high or low. Users cant change, I have entered the same input for R1 , capital as 1 lac, with risk per trade as 1%, target 1% with limit order and TSL as 1%

But can you see the difference in quantity here? Yes, its because on R1 risk management rules, the risk is always fixed.

PCJ

Buy trigger at 140.6 and sell trigger at 133.5. The difference between these two is the risk which is 7.1

So when Buy triggered at 140.6, my stop loss is 133.5

When Short triggered at 133.5, my stop loss is 140.6

As I have given 1% as risk input, it means i should not lose more than Rs.1000 when stop loss hits. So accordingly quantity is calculated, 1000/7.1=140 quantity.

Risk Management 1

So in Risk Management 1- R1, only quantity keeps varying based on your risk input, stop loss is always based on ORB range high/low.

If users want to follow similar logic with R2 , by keeping stop loss as ORB high/low instead of any fixed percentage, then you can enter just your capital and target alone.

RISK MANAGEMENT 2 with default SL

As you can see in the above image, we only entered capital as 1 lac and target as 5%. Risk we did not specify, so the bot will consider ORB range high/low as stop loss. you can see my quantity is 711 for PCJ, how quantity is calculated here? We allocate our full capital to each stock, my capital is 1 lac and my entry price is Rs.140.6, so quantity is 100000/140.6= 711 quantity.

PCJ

Buy trigger at 140.6 and sell trigger at 133.5. The difference between these two is the stop loss here which is 7.1

So when Buy triggered at 140.6, my stop loss is 133.5

When Short triggered at 133.5, my stop loss is 140.6

As we have not given risk input, when stop loss hits for pcj, we end up losing 7.1*711=Rs.5048. So we end up losing 5% in this trade when stop loss hits.

That’s the risk you will have, if you do not enter your risk input in R2. The wider the range, higher the risk you will have.

Now we have explained in detail about the difference between the two, follow the below instruction to place your orders.

Open Telegram and enter the bot name @ORB_Instant_bot click on START , select Square Off stocks

Choose your Risk Type , enter the Input, click on the button and proceed to place the order.

ORB Orders can be placed on 5 mins interval, If you wanted to trade first 5 mins breakout, then you can enter your capital and target at 9.20, which will generate files for 5 mins ORB range breakout instantly, if you want 10 mins ORB range breakout, you can give your input at 9.25 AM, so that it calculates the 10 mins range (9.15–9.25) and sends you the link instantly.

Folks who wanted to use the 15 mins breakout strategy can give their input at 9.30 AM and it goes on like that.

Your own stock list:

Now coming to the latest upgrade, you can trade ORB based on your own choice of stocks. Just click the button My Stocks and enter your stocks name and enter. As of now, only list of stocks that are part of FnO can be entered. To know the list of stocks that are part of FnO can be found form this NSE link.

Please make sure, you type all your stock list in go separated by comma in capital letters and enter.

RELIANCE,INFY,TCS,WIPRO,SBIN

Once I entered the stocks name, it gives a confirmation. Now click on Risk type, R1 or R2 and enter your input and click on the button to place the orders.

As per the stock list, you have given it allows you to place the orders for them.

R1 : Risk Management 1 is more conservative approach where position sizing is done based on capital.

R2 : Risk Management 2 is more aggressive approach where position sizing is done based on stock price. It gives higher returns with higher risk.

We have tested the following scenario since Jan 2019 and here’s the result that you can download .

Stocks : Square Off stocks

Risk Type : R2

Target : No Targets, just EOD exit. But as its mandatory to mention target values in BO orders, you can enter higher percentage like 50%, so that its not hit easily, where it gets exited by EOD.

RISK: Default, just do not enter any values, so that ORB High/low will be considered as default stop loss values.

Here’s the results for orders placed for Both Top & Bottom.

Top & Bottom

Listed below the results for orders placed for Momentum Top ONLY.

Momentum Top 5

Listed below the results for orders placed for Momentum Bottom ONLY.

Momentum Bottom 5

All these different metrics should help you, and you can pick your choice of basket and place the trades accordingly

2 Likes