NexusFi: Find Your Edge


Home Menu

 





MTF Different Instruments Same time but handling missing bars


Discussion in NinjaTrader

Updated
    1. trending_up 1,169 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

MTF Different Instruments Same time but handling missing bars

  #1 (permalink)
 leinster 
Brussels / Dublin
 
Experience: Intermediate
Platform: ninjatrader
Trading: Stdev + 2
Posts: 468 since Jun 2010
Thanks Given: 844
Thanks Received: 595

Hi,

Using Closes[1][0] && Closes[0][0] aswell as Times[0][0] && Times[1][0].

I have two instruments (which are similiar but on different markets).

Example: 1 = Euronext Milling Wheat Futures (Traded in europe) and 2 = Wheat (Traded on GLOBEX).

In this example i want to compare the price of european milling wheat versus wheat in the US. So i have put together an indicator to do this however i am facing a pretty common issue which im sure other's have seen.

Timeframe is 1 minute for both as i dont need to be blatantly high frequency.

But when i compare the bar's they do not always overlap on the right days / times reason being there are obviously holidays in states that are not in EU. My own PC runs eastern time so at least Times compares just eastern time.

I took a look at the correlation indicator on the forum and seen the following embedded into the onbarupdate and was thinking this might suffice if i take this code hack it and just wrap it at the start of my code and place a try whenever the timestamp's actually lineup. :

if( CurrentBars[0]<window || CurrentBars[1] < window ||(Closes[0].Count < window) || (Closes[1].Count < window) ) return;
double[] signalA = new double[window];
double[] signalB = new double[window];
int count = window;
for (int index = 0; index < count; index++)
{
if (null != Closes[0][index] && null != Closes[1][index]) {
double currentAClose = Closes[0][index];
signalA[index] = currentAClose;
double currentBClose = Closes[1][index];
signalB[index] = currentBClose;
} else {
Print("Corr - Missing bar, disregarding");
}
}

Is there a better way to do this that im not thinking of as id like the code to be as succinct as possible?

Started this thread Reply With Quote





Last Updated on March 19, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts