Calculate GAP (Close of Prior Day, Open of Current Day) - NinjaTrader Programming | futures io social day trading
futures io futures trading


Calculate GAP (Close of Prior Day, Open of Current Day)
Updated: Views / Replies:6,711 / 16
Created: by bluemele Attachments:2

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 2  
 
Thread Tools Search this Thread
 

Calculate GAP (Close of Prior Day, Open of Current Day)

  #1 (permalink)
Elite Member
Honolulu, Hawaii
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: ATC/TT, AMP/Zen-Fire, AMP/CQG
Favorite Futures: TF
 
bluemele's Avatar
 
Posts: 2,547 since Jun 2010
Thanks: 3,806 given, 2,826 received

Calculate GAP (Close of Prior Day, Open of Current Day)

How to best calculate prior day close in Ninja? What is the most detailed method as when I find 'last close' it doesn't seem to match w/ Tradestation?

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,573 given, 3,982 received


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.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
 
  #4 (permalink)
Elite Member
Honolulu, Hawaii
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: ATC/TT, AMP/Zen-Fire, AMP/CQG
Favorite Futures: TF
 
bluemele's Avatar
 
Posts: 2,547 since Jun 2010
Thanks: 3,806 given, 2,826 received


sam028 View Post
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.

Yes, I can do that in an indicator. I was curious if there was already one or if it was built into Ninja at all anywhere?

I will give it a try.

Reply With Quote
 
  #5 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary

Answer
This post has been selected as an answer to the original posters question Answer


bluemele View Post
How to best calculate prior day close in Ninja? What is the most detailed method as when I find 'last close' it doesn't seem to match w/ Tradestation?

Before you do this, three decisions to be taken:

(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.

Attached Thumbnails
Calculate GAP (Close of Prior Day, Open of Current Day)-session-template.png   Calculate GAP (Close of Prior Day, Open of Current Day)-gap.jpg  
Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #6 (permalink)
Elite Member
Honolulu, Hawaii
 
Futures Experience: Intermediate
Platform: NinjaTrader
Broker/Data: ATC/TT, AMP/Zen-Fire, AMP/CQG
Favorite Futures: TF
 
bluemele's Avatar
 
Posts: 2,547 since Jun 2010
Thanks: 3,806 given, 2,826 received


Fat Tails View Post
Before you do this, three decisions to be taken:

(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.

FatTails,

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.

Reply With Quote
 
  #7 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


bluemele View Post
FatTails,

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.

This is the way I pull it:

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.

Reply With Quote
 
  #8 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,218 since Jun 2009
Thanks: 628 given, 6,316 received
Forum Reputation: Legendary


bluemele View Post
FatTails,

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.

or go to my pivots look up contracts you interest in
Daily Notes - Metrics for Day Traders

Reply With Quote
 
  #9 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


cory View Post
or go to my pivots look up contracts you interest in
Daily Notes - Metrics for Day Traders

But then every day you need to enter the values manually...

Reply With Quote
 
  #10 (permalink)
Elite Member
Quebec
 
Futures Experience: Intermediate
Platform: NinjaTrader wt Rancho Dinero's profiling tools
Broker/Data: Stage 5 trading/AMP/CQG
Favorite Futures: ES, NQ, YM
 
trendisyourfriend's Avatar
 
Posts: 3,697 since Oct 2009
Thanks: 3,041 given, 4,496 received



Fat Tails View Post
But then every day you need to enter the values manually...

He might uses this new indicator too to plot the daily pivots or any other levels:
https://futures.io/free_downloads/ninjatrader-7/indicators/797-download.html

Reply With Quote

Reply



futures io > > > > > Calculate GAP (Close of Prior Day, Open of Current Day)

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
All Major Global Equity Markets Close Below Their 50-day M.A. kbit News and Current Events 0 May 24th, 2011 02:57 AM
effect of gains and losses of previous day on next day tradersam Psychology and Money Management 2 May 18th, 2011 04:35 PM
Prior Day HLC for NT josh The Elite Circle 23 April 22nd, 2011 06:05 PM
Function to calculate Pip Value in current currency arjfca The Elite Circle 7 September 28th, 2010 07:43 AM
Volitility indicator question - Open - Open / open - close / close to open andresimon NinjaTrader 2 September 27th, 2010 01:33 AM


All times are GMT -4. The time now is 02:27 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-15 in 0.15 seconds with 38 queries on phoenix via your IP 54.226.132.197