Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Run strategy on ES Chart but place trade on MES

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

    Run strategy on ES Chart but place trade on MES

    When I trade manually, I use the tick chart on the ES but when I place a trade, I have it place against the MES. Is this possible on for my strategy?

    #2
    Hello thaison316,

    Thank you for your post.

    You would be able to create a strategy that could be enabled on the ES chart but submits orders to the MES instrument. To do so, you would add a secondary data series to your strategy and have orders submitted to that added series.

    AddDataSeries() would be used to add a secondary series in your script. Then, you would use a BarsInProgress == 1 check to check for the added secondary series followed by placing orders.

    See the help guide documentation below for more information.
    AddDataSeries() - https://ninjatrader.com/support/help...dataseries.htm
    BarsInProgress - https://ninjatrader.com/support/help...inprogress.htm

    Let us know if we may assist further.
    <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


      #3
      I'm running this on an ES 2000 TickCharts.
      else if (State == State.Configure)
      {
      AddDataSeries("MES 06-21", BarsPeriodType.Tick, 950, Data.MarketDataType.Last);

      }

      OnBarUpdate() Print(BarsInProgress);

      Only return 0 on the output console. What am I doing wrong?

      Comment


        #4
        Hello thaison316,

        Thank you for your note.

        You are adding the secondary data series to your script correctly. Ensure that your script does not call if (BarsInProgress != 0) return;. This condition would check to see that only the primary data series is being processed.

        To check if the added secondary series is processing you would need to add a condition to your script that checks if (BarsInProgress == 1) { }. Then, you would add the logic that you would like to occur on the added series within this condition.

        See the example in the BarsInProgress help guide documentation which demonstrates checking which bars object is being called - https://ninjatrader.com/support/help...inprogress.htm

        Also, see this help guide documentation regarding working with Multi-Timeframe & Multi-Instrument scripts. Specifically, see the 'Adding Additional Bars Objects' and the 'Entering, Exiting, and getting Position information' sections - https://ninjatrader.com/support/help...ionInformation

        And, see the SampleMultiTimeframe and SampleMultiInstrument scripts that come default with NinjaTrader for an example of working with multiple timeframes and instruments. To view the code of the scripts, open a New > NinjaScript Editor window, open the Strategies folder, and click the SampleMultiTimeframe and SampleMultiInstrument scripts.

        Let us know if we may assist further.
        <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
        44 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        124 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        65 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