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 NullPointStrategies, Today, 05:17 AM
    0 responses
    50 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    126 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    69 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X