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

BarsInProgress in Multi Instrument and simultaneous executions

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

    BarsInProgress in Multi Instrument and simultaneous executions

    Hello,
    I am developing a strategy that executes simultaneous orders on two different instruments. One of the instruments is ES 12-17 and the other is ES 09-17.

    The second expiration ES (12-17) has lower amount of historical data due to lower volumes.


    I am executing my orders with the following code:

    "
    if (Positions[0].MarketPosition == MarketPosition.Flat)
    {
    EnterShort(0, 1, "Short Alpha");
    }
    if (Positions[1].MarketPosition == MarketPosition.Flat)
    {
    EnterLong(1, 1, "Long Beta");
    }

    "

    I however noticed that on some occasions the execution only takes place on the first instrument (ES 09-17). And does not execute on the second instrument.

    Not sure if the reason for this is any market data missing, but I tried to add

    if (BarsInProgress == 0 & BarsInProgress == 1)
    {

    [All STRATEGY CODE]

    }


    but when I added it nothing ever was executed as if the strategy didnt run at all.

    When I remove that code, executions are made, but sometimes not simultaneous/symmetrical (e.g. only the ES 09-17 gets executed).

    Please help!

    #2
    Hello nikolaalx,

    I suspect that the reason it doesn't take another trade is because of your EntriesPerDirection and Entry handling settings, which you can read about at the following links,





    If you set EntryHandling = EntryHandling.AllEntries, do you see entries on both instruments?

    I look forward to your reply.
    Alan P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by jaybedreamin, Today, 05:56 PM
    0 responses
    7 views
    0 likes
    Last Post jaybedreamin  
    Started by DJ888, 04-16-2024, 06:09 PM
    6 responses
    18 views
    0 likes
    Last Post DJ888
    by DJ888
     
    Started by Jon17, Today, 04:33 PM
    0 responses
    4 views
    0 likes
    Last Post Jon17
    by Jon17
     
    Started by Javierw.ok, Today, 04:12 PM
    0 responses
    12 views
    0 likes
    Last Post Javierw.ok  
    Started by timmbbo, Today, 08:59 AM
    2 responses
    13 views
    0 likes
    Last Post bltdavid  
    Working...
    X