Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Sync Multiple Time Frames

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaTrader_ChrisL
    replied
    Hello sdauteuil, thanks for your reply.

    We use the ELSE clause when we want something to happen if the previous condition was explicitly false. The ELSE part will only be evaluated if the above IF is false. In this case you would want to use
    if (BarsInProgress == 1)
    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);

    if (BarsInProgress != 0)
    return;

    Please let me know if I may provide any further information.

    Leave a comment:


  • sdauteuil
    replied
    Which is the proper use of if and else if in this instance? Use If and else if OR Use 2 if statements

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);

    if (BarsInProgress != 0)
    return;

    if ((CurrentBars[0] < 20)
    || (CurrentBars[1] < 20)
    || (CurrentBars[2] < 20))
    return;

    // Rest of Code

    OR

    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 1)
    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);

    else if (BarsInProgress != 0)
    return;

    if ((CurrentBars[0] < 20)
    || (CurrentBars[1] < 20)
    || (CurrentBars[2] < 20))
    return;

    // Rest of Code

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello sdauteuil,

    In real time is it possible to have the primary bar / time frame operate under OnBarUpdate()
    and have the additional time frame (3 minute in this case) operate OnEachTick.

    Basically if I am using OnBarUpdate can I access the current / real time value of the other time series?
    No however when using OnEachTick you could simulate that by using IsFirstTickOfBar as long as you are using a BarsType which supports that. Basically all bars types except renko.
    https://ninjatrader.com/support/help...FirstTickOfBar

    Also I currently do not have the code to sync the 1 tick time frame for cumulative delta.

    Should I add this (code below) under State == State.DataLoaded?
    Yes but that would go in OnBarUpdate just like the sample shows, that is required for this indicator.

    Please let me know if I may be of additional assistance.

    Leave a comment:


  • sdauteuil
    replied
    Also I currently do not have the code to sync the 1 tick time frame for cumulative delta.

    Should I add this (code below) under State == State.DataLoaded?


    else if (BarsInProgress == 1)

    {

    // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync

    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);

    }

    Leave a comment:


  • sdauteuil
    replied
    In real time is it possible to have the primary bar / time frame operate under OnBarUpdate()
    and have the additional time frame (3 minute in this case) operate OnEachTick.

    Basically if I am using OnBarUpdate can I access the current / real time value of the other time series?

    Leave a comment:


  • NinjaTrader_Jesse
    replied
    Hello sdauteuil,

    From the description that sounds correct, when using 0 bars ago that would return the last closed bars value. Depending on what series called the Closes[2][0] that would return the last closed 3 minute bar at that time in processing. Only if you are in Realtime and using OnEachTick calculation would the Closes[2][0] represent that series last price.

    The other logic you have shown is needed specifically for the CumulativeDelta indicator because that is required for it to work, that is not something you would need when adding other series or using other indicators.

    Please let me know if I may be of additional assistance.

    Leave a comment:


  • sdauteuil
    started a topic Sync Multiple Time Frames

    Sync Multiple Time Frames

    What is the proper way to synchronize multiple time frames in a strategy and return the current value of additional time series?

    I have a strategy using cumulative delta which requires a secondary 1 tick time frame and I have an additional 3 minute time frame...

    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    AddDataSeries(Data.BarsPeriodType.Minute, 3);
    }

    I need to synchronize them. Part of the logic is the current close is higher than the open of the 3 minute bar. (for longs)

    (Closes[2][0] > Opens[2][0])

    It looks like the values of the previous 3 minute candles are being returned not the current.

    I see under help guide cumulative delta instructions on syncing the 1 tick time frame.

    else if (BarsInProgress == 1)

    {

    // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync

    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);

    }



Latest Posts

Collapse

Topics Statistics Last Post
Started by dr0832, Today, 07:02 PM
0 responses
6 views
0 likes
Last Post dr0832
by dr0832
 
Started by mlurskint8, Today, 05:27 PM
3 responses
18 views
0 likes
Last Post NinjaTrader_ShawnB  
Started by SteveTheCPA, Today, 04:54 PM
0 responses
8 views
0 likes
Last Post SteveTheCPA  
Started by Unsuitable, Today, 02:42 PM
2 responses
12 views
0 likes
Last Post Unsuitable  
Started by ralett, Today, 11:52 AM
4 responses
28 views
0 likes
Last Post ralett
by ralett
 
Working...
X