OPEN-SOURCE SCRIPT

iBox, Initial Balance | IB High, Low, Midpoint | Opening

Updated
This Indicator will print basically 4 lines.
You have to understand the importance of the "Initial Balance" the first trading hour of Cash session is very important in trading stocks and indizes.

So you will get 4 lines:
  • Opening
  • Initial Balance High
  • Initial Balance Low
  • Initial Balance Midpoint/Halfback


Most indicators for Range Box, Opening Trade, Opening Range, Initial Balance, iBOX and "Ultimate Lines" will only use the timezone of the exchange or your own timezone. I'm living in europe and we have this daylight saving time change in Summer/Winter - which will cause problems with most of the existing indicators or at least will push you to change the times regularly.

Another important point: I really like to switch the indizes when trading on my mobile. So what will happen when you set up opening range for DAX at 09:00 and then switch to S&P500? All indicators I tried failed here - they will just draw a wrong line for SPX, NDX, DJI, FTSE, ASX etc. I fixed that and hard coded stock exchanges and ticker symbols into 3 main groups Initial Balance EU/US/Asia


For example we take DAX - XETRA DAX is opening at 09:00 MEZ (Europe/Berlin)
The Initial Balance is set during the H1 Candle from 09:00 - 09:59

Please be aware, that some cash indizes only deliver data to TradingView after the "opening auction" - so for Xetra DAX you have to book live data and often you will only see data at 09:02/09:03 after the opening auction.
So you will get different opening lines compared from cash to future or your CFD provider. Future and CFD should fit for 99%

  • The Opening Line will be drawn at exactly 09:00
  • IB High on the highest price during the H1 candle
  • IB Low on the lowest price during the H1 candle
  • IB Halfback is simple: (IB High + IB Low) / 2


The lines will be drawn from cash start until next day and will end 2 minutes before the next cash session will start again. Please make your own experience! Activate the indicator for a CFD or Future switch to M15 and watch the wicks around the 4 lines. Even in the night or the next morning before the next Initial Balance will be set.
For me the lines are valid for around 24 hours and often longer. That's why it's good to have the old lines on the chart too.

To-do:
  • Yesterday high / low / close / halfback (also for last week and month)
  • Labels for the lines - sometimes only the colors will confuse you - a simple label should be a benefit (IB_h, IB_l, IB_1/2, 1D_o)
  • Range Lines for Asia Range and Premarket Range - additionaly a parameter to disable premarket lines when premarket is trading in asia range.
  • Add Alert condition to get alerts after IB is set


If you have and thoughts, ideas or improvements, please send me an message or leave an comment!

Like i said, the stock exchanges and ticker symbols are hard coded and can be extended for all relevant assets.

Have fun and i really hope this indicator will help improving your trading experience!
Release Notes
Added SSE and HSI exchange and AU200AUD ticker for ASX
Release Notes
Added new Ticker for Australia and Germany
Release Notes
Added a few more ticker symbols for USA, Europe and Asia!
Release Notes
Added all available Indices from CFD Providers into an Excel sheet and cleaned + combined it there. All TV sources are available now and the syminfo.ticker string is coded into one single line. Just copy&paste from excel.

That's easier to manage ;-)
Release Notes
Added 2 new functions for the Asia Session Range.
As an example: If you are in EU and an DAX trader - you will closely watch the range, that was formed for the DAX Future during the Asia Session. A breakout of Asia high or low is a nice trade. The session lines are often a valid support/resistance during the whole cash session.

And if it's no support/resistance you can trade the breakout in both directions.
Release Notes
Added an Universal Initial Balance! Now if you are trading commodities or just stocks, that doesn't match the predefined indizes the code will switch automatically to the universal IB range. Just select your home timezone and define your preferred time in the Universal IB Range selector and there you go!

Please leave a comment, this feature was often requested, i'm happy to deliver and make this beauty of indicator way better.

Still a lot of unused code there, but i optimized the settings window and clustered the settings better. Was a mess before...
Release Notes
Big update!

You can see the standard settings on the left and the full enabled version on the right.

  • Added Labels for the Lines - not really like it atm because it's overkill...
  • Added IB Range Extension. This was asked several times. You can now add the 1.5 and 2.0 Extension of the IB Range - was new for me but seems to be useful.
  • Cleaned up a lot of the source code
  • Added the Asia Range for US Tickers. So you should see now the Asia Range Lines if you are trading NDX and SPX


To do:
  • Will try to add an parameter "only show labels during actual day"
  • Will try to disable lines if they are too close to each other - i still like it simple...
  • People are asking for EU Range when trading US indizes / stocks. Asia Range was the start, have to rework the code to show EU range too. EU Range is different from EU Session...



Have fun! And as always leave an comment if you like it or have problems. If this little project is finished in some months we should ask for an editors pick label ;-)
Release Notes
Changed the plot of Asia Session Lines - they are automatically extended now, like the IB Range - there is no need anymore to tick the 2nd Parameter

Changed the plot of lines for the actual day. The lines are only plotted until the actual time - now you are able to see the labels for the actual bars and don't have to scroll to the right side to see the labels.
Release Notes
Enhanced the script regarding this topics:
  • Sorted the Timezones like continents
  • Added Brazil for SA
  • Separated Tokyo from Asia Range into Tokyo Zone
  • Separated ASX from Asia Range into Oceania Zone
  • Added India for Nifty50 Traders into India Zone
  • Made Prework for future sessions (Asia, London, US, Globex - just have to sort out the different Information and times...)


NIFTY
NKY
XJO
IBOV
Release Notes
// 12.2022 seems that my changes where not saved. So had to reupload it...
Release Notes
Reworked the whole settings menu

Reworked a lot of the coding to improve performance

Added the often asked setting to show yesterdays closing line! Please be aware that this is not working properly with Tickers that have sessions and futures roll-overs like FDAX1!. No idea why...
Release Notes
Added all crypto exchanges from TV and a set of crypto pairs from other exchanges. Discussed with Gert van Lagen about Initial Balance for Cryptos and aligned on UTC+0 as official start for the crypto day - seems very legit! Thanks Gert!
Deactivated closing line buy default, because i still don't like the behaviour on Futures...
Release Notes
Reworked the Index and Ticker detection and switched the code to an array. That will drastically improve the performance!
Crypto is now full available with UTC+0 as Initial Balance

smaller changes for the settings menu.
Release Notes
Changed the calculation of the IB Extension to this:
IB Range is 100 points so
IB High 1.5 = IB High + 50 Points
IB High 2.0 = IB High + 100 Points
etc.

Let the old calculation active as "Use alternate IB Extension calculation" Switch. This will help if the distance from opening to one IB line is extremely short like on a gap and go situation...
Release Notes
Big Update, please be sure that you are always using the latest version of the script!
  • Added new Ticker and Exchanges
  • Added SouthAfrica as Exchange JSE and CFDs
  • Added Premarket Range for US and EU
  • Added 2 more IB Extensions and clarified the "alternate calculation". A narrow IB Range will often guide to an big range extension. Now you can acivate the extremes
  • Besides the Yesterday Closing Line: I Added Yesterday High and Yesterday Low Line
  • Prepared code for an GAP Detector to see Cash GAPS in CFD/Future, but i think this should be done in an separate indikator.
Release Notes
Enhanced the changelog and saved it again, to get the really latest version published.
Updated the chart to SPY to show the new lines.
Release Notes
Another big update, please be sure, that you delete the iBOX indicator from your charts and add it new to your layouts! Otherwise you will not benefit from the latest feature updates!

And as always: Please report bugs directly. Thanks!

  • Added crossover and crossunder Alertconditions for all Lines. So you can easy set unlimited alerts, if the price is crossing an IB Line -and for sure it will only send an alert after the IB Range is set!
  • Added the Plot x Days back Feature, FINALLY!!

Release Notes
PLEASE: Remove the Indicator and add the newest Version to your charts. TV doesn't support auto updates.
Added the possibility to fill the space between the IB Lines. Thanks to @tonys.6829 for this request. Makes sense.

Changed the Initial Balance End Time. from xx:59 to xx:00 and xx:14 to xx:15. This will help the 1 Minute and lower timeframe to catch the latest movement before closing IB Range.
This will not affect the M5 Chart or greater it is just for really low TF and a lack of calculation rules in Pine.
Bands and ChannelsChart patternsIBiboxinitial_balanceinitialbalanceopening_candle_breakoutopeningrangeopeningrangehighloworbPivot points and levels

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Got a lot of feature requests to pay for additions. I will never ever charge any money or sell subscriptions for retailers.

If the idea is good, i will sit down and try to make it happen for free. You can buy me a coffee instead.
Also on:

Disclaimer