Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Calculate GAP (Close of Prior Day, Open of Current Day)
Try in testing Bars.FirstBarOfSession.
If you are in this bar, then Close[1] is the close of the previous day, so you can check if you have a gap or not.
(1) Do you want to display a 24 hour chart including night session or do you only want to display the day session?
(2) Do you want to use last or settlement for yesterday's close?
(3) Do you want to display ETH or RTH open?
Assumption: I assume that you want to
(1) display a 24 hour chart
(2) use the settlement price
(3) use the RTH open
Settlement can only be collected from daily data, RTH open can be only collected from intraday data by using an appropriate session template. So you need
(a) to set up an appropriate session template
(b) to connect to a daily data provider who was the settlement (for example Kinetick EOD)
(c) to code an indicator who does the trick.
(a) Session template for ES is attached.
(b) Data provider ?
(c) Indicator needs to be coded, but just to check you can use the SessionPivots indicator in DailyBars mode (default setting) as it will display yesterday's settlement, and the OpeningRange indicator in RTH mode / second (default setting), which will display today's open. If I merge the indicators and scrap the unwanted rest, they can jointly do what you are looking for. Chart is attached.
You are right 100%. That is exactly what I want. Let me go through this and give me some time to digest. My C# skills are not great compared to perl or other script based languages, so it would be a long haul for me to create this.
The Instruments I would like to calculate are ES, TF, CL, 6E, GC etc...
With TradeStation it shows it in the Time & Sales window (yesterdays settlement, so I can just calculate it).
Let me go over what you posted and give it some more thought. At the end of the day if I just had yesterdays settlement price in NinjaTrader, then it would be best. I guess I would pull that off a daily chart via EOD data feed from what you are saying.
I use Kinetick EOD (has the settlement price) and Interactive Brokers. I first-connect to Kinetick, so daily data is loaded from Kinetick, and then second-connect to Interactive Brokers, and my intraday-data comes from Interactive Brokers.
Nota: If you do this in SIM-Trading, you cannot execute orders, but it works in real trading or with the simulation account of Interactive Brokers.
Now the pivot indicator collects daily data -> you can look at the NinjaTrader default Pivots indicator how to do that and simply copy the code into your new indicator
For the RTH open you need to divide you trading day into 2 sessions. The open of the first bar of the second session is the value that you look for! So the logic goes as
if <new trading day> then do nothing (this is the Globex open)....
if (Bars.FirstBarOfSession), but not <new trading day>, then collect the open of the current bar....
The new trading day can be checked with Bars.GetTradingDayFromLocal(Time[0]), you need to check the date of the current bar against the date of the previous bar
Have a look at the opening range indicator, it does follow this logic.
I modified the Chartnotes indicator from Monpere in order to plot S/R lines from an excel file or any editor. A full explanation can be found at https://nexusfi.com/ninjatrader-programming/7677-help-please-moving-spreadsheet-values-into-con …