Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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.
    Brandon H.NinjaTrader Customer Service

    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.
        Brandon H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by trilliantrader, 04-10-2024, 09:33 PM
        6 responses
        25 views
        0 likes
        Last Post trilliantrader  
        Started by traderqz, Today, 12:06 AM
        5 responses
        10 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Mongo, Today, 11:05 AM
        2 responses
        10 views
        0 likes
        Last Post Mongo
        by Mongo
         
        Started by guillembm, Today, 11:25 AM
        0 responses
        4 views
        0 likes
        Last Post guillembm  
        Started by Tim-c, Today, 10:58 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Working...
        X