NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Indicator Development

Indicator Development Support for the development of custom indicators using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 12-01-2010, 05:45 PM   #1
jdfagan
Senior Member
 
Join Date: Feb 2009
Location: Redwood Shores, CA
Posts: 174
Thanks: 0
Thanked 0 times in 0 posts
Question How to determine when contract has rolled over

I'm using following chart:
* Intraday chart (e.g., Renko)
* Instrument of EMD 12-10 with default session template (which is CME US Futures RTH I believe)
* Merge policy is set for MergeBackAdjusted

I'm trying to determine the boolean logic to detect when we've rolled over to new contract within a continuous contract intraday chart that auto-merges many contracts per the merge policy setting. I want to detect this historically via the indicator if possible so I can see the precise first bar in my chart for a newly rolled over contract (e.g., in March, June, Sept, Dec for index type futures).

I've tried a couple of ideas - like Bars.TotalTicks or Bars.TickCount for the variable to check against but still no luck, for example:

Code:
if (Bars.TotalTicks > 1)   //<---- Not sure of if expression here to detect rolled over contract
    //Found first bar of new contract that we've rolled over/merged into on this chart
    Print(String.Format("Rolled Over Contract Detected with {0} on TickCount {1}, Bar {2},  [{3}]", 
            Instrument.FullName, Bars.TickCount, CurrentBar, Time[0]));
Maybe the problem I have is using RTH session template instead of ETH. If anyone has other ideas on how to accomplish rollover detection in the past within a continuous contract which uses merging, I'd be grateful in hearing your solution

JD
jdfagan is offline  
Reply With Quote
Old 12-02-2010, 05:39 AM   #2
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 22,377
Thanks: 252
Thanked 966 times in 949 posts
Default

JD, unfortunately you could not programmatically access the rollover dates defined. You can perhaps add the dates yourself to the script for example as StringSeries and then check off against this.
NinjaTrader_Bertrand is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine if using 64bit bobcat70 Miscellaneous Support 1 09-14-2010 11:33 PM
How can you create a continuous contract for long term futures contract backtesting Thorserb2 Market Analyzer 11 03-16-2010 11:19 AM
How to determine whether an instrument is dealable or not Buthus Strategy Development 7 11-06-2009 06:30 AM
Merging previous contract to create Continous contract? cw30000 Charting 2 10-28-2009 10:01 AM
ninja automatically rolled es to dec chan123 Miscellaneous Support 4 09-10-2007 11:15 AM


All times are GMT -6. The time now is 09:53 PM.