Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Playback on multiple sybmols in strategy

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

    How to Playback on multiple sybmols in strategy

    Hi,

    I have a strategy attached to my primary chart and the symbol is NQ. I am entering a position on MNQ based on certain data points on my main NQ chart. When I do this in Playback I do not see any positions being entered

    Sample code :

    protected override void OnStateChange ()
    {
    else if (State == State.Configure)
    {
    AddVolumetric(Instrument.FullName, BarsPeriodType.Second, TimeFrame, VolumetricDeltaType.BidAsk, 1);
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    AddDataSeries("MNQ 09-23", BarsPeriodType.Minute, 1);
    }​
    }

    protected override void OnBarUpdate() {

    if (BarsInprogress == 0) {

    //if certain conditions on NQ chart are met enter long or short on MNQ
    EnterLong(3, QUANTITY, "long");

    }

    }


    The code above does not error in Playback . If I change EnterLong(3...) to just EnterLong(QUANTITY) I see it take a position on the current chart NQ.

    Any help will be appreciated. Do I have to download the same day data for MNQ ?

    #2
    Hello hgear1786,

    Thanks for your post.

    Yes, you will need to download Market Replay data for each instrument and date being accessed/tested in the strategy to properly use the strategy with the Playback connection and Market Replay data.

    Downloading Market Replay Data: https://ninjatrader.com/support/help...jaTraderserver
    Playback: https://ninjatrader.com/support/help...8/playback.htm

    Further, I see you are calling AddVolumetric() dynamically. The instrument argument and baseBarsPeriodTypeValue argument when calling AddVolumetric() must be hardcoded into your strategy.

    From the AddVolumetric() help guide: "Arguments supplied to AddVolumetric() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. "

    AddVolumetric(): https://ninjatrader.com/support/help...volumetric.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    134 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    118 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    67 views
    0 likes
    Last Post PaulMohn  
    Working...
    X