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

strategy running on ES that sends orders to micro es

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

    strategy running on ES that sends orders to micro es

    Hi im trying to get my strategy that executes on the ES to place orders on micro es at the exact same time.

    Im finding a bit of a delay between the time the ES order is submitted and the MES

    in my code example below the main data series is the MES and ES would be the second data series. . My main ES strategy uses on bar close true.and im trying to make sure we ignore the primary MES data series to avoid delays.

    Any ideas why their is a delay when placing orders on MES ? and what is the best way to go about getting exact order timing for both markets?

    thanks,



    protected override void OnBarUpdate()
    {
    if (BarsInProgress != 0) - this is the MES chart
    return;

    if (BarsInProgress == 1) This is the ES chart
    return;

    if (CurrentBars[0] < 1
    || CurrentBars[1] < 1
    || CurrentBars[2] < 1
    || CurrentBars[3] < 1
    )

    return;

    #2
    use ES as the primary BarsArray[0] - and submit orders to the secondary MES? BarsArray[1]

    protected override void OnStateChange()
    {

    ....... if (State == State.Configure)
    {
    AddDataSeries("MES 09-19", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
    }
    protected override void OnBarUpdate()
    {

    .......
    //do primary techncials and submit to secondary instrument added onInit
    if(BarsInProgress==0)
    {
    if (CurrentBar < BarsRequiredToTrade)
    return;

    if (CrossAbove(smaFast, smaSlow, 1))
    EnterLong(1,1,"L-MES");
    else if (CrossBelow(smaFast, smaSlow, 1))
    EnterShort(1,1,"S-MES");

    return;
    }

    //do stuff here for secondary MES

    }
    MicroTrends
    NinjaTrader Ecosystem Vendor - micro-trends.co.uk

    Comment


      #3
      "Any ideas why their is a delay when placing orders on MES ? and what is the best way to go about getting exact order timing for both markets?"
      The other way might be to link 2 parallel strategies master slave - and push the signal through from ES to MES - you can backtest the ES or MES with that you can backtest and only write 1 strategy but use it in 2 modes - Master or Slave... master calls Long/Short on Slave for example...

      more advanced
      fastest way - You can always just use the account object and bypass loading bars for MES - for example just run your rule son the ES - but copy the trades to the MES in realtime - cant backtest that though... and you might need to take care of the strategy trade man- also via account object

      MicroTrends
      NinjaTrader Ecosystem Vendor - micro-trends.co.uk

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by trilliantrader, 04-18-2024, 08:16 AM
      4 responses
      18 views
      0 likes
      Last Post trilliantrader  
      Started by mgco4you, Today, 09:46 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by wzgy0920, Today, 09:53 PM
      0 responses
      9 views
      0 likes
      Last Post wzgy0920  
      Started by Rapine Heihei, Today, 08:19 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by Rapine Heihei, Today, 08:25 PM
      0 responses
      10 views
      0 likes
      Last Post Rapine Heihei  
      Working...
      X