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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X