Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Running a strategy across multiple instruments with contract limit

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

    Running a strategy across multiple instruments with contract limit

    Hi,

    I have a strategy running and have it running on a single chart, MGC.
    I would like to also have it run on MNQ, but I don't want them separate from each other.

    I only want to own 1 contract at a time and ideally share the same process (as in they go through a single OnBarUpdate and aren't running their own processes). This way variables and their values will all be shared.

    What I want to do things like this (pseudocode):​​​​​​

    Code:
    if (MGC && BUY_COND && NO_POSITION) EnterLong for MGC
    if (MNQ && BUY_COND && NO_POSITION) EnterLong for MNQ
    
    if(MGC && CHANGE_ORDER_COND) ChangeOrder for MGC
    if(MNQ && CHANGE_ORDER_COND) ChangeOrder for MNQ
    I just want to be able to enter any future I'm interested it there is an opportunity, but don't want to hold more contracts than my account can handle.

    #2
    Hello brettcomardelle93,

    Thanks for your post.

    If you want to create one strategy that trades on multiple instruments, you can add the the other instrument as an additional data series so the strategy can process data for that instrument and to also place orders to that instrument.

    Please review the documentation below for working with multi time frame and multi instrument strategies.

    Multi Time Frame and Instruments (Important read!) - https://ninjatrader.com/support/help...nstruments.htm

    You may also wish to reference the SampleMultiInstrument strategy that comes with NinjaTrader as well.

    To create logic that limits how many contracts that can be entered, you can use Account.Get to get your account's CashValue and Unrealized PnL to track your funds available and check if the available funds will allow opening your position.

    Account.Get - https://ninjatrader.com/support/helpGuides/nt8/?get.htm

    AccountItems - https://ninjatrader.com/support/help...ccountitem.htm

    We look forward to assisting.
    JimNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by vibrationketousa, Today, 12:26 AM
    0 responses
    1 view
    0 likes
    Last Post vibrationketousa  
    Started by vibrationketousa, Today, 12:24 AM
    0 responses
    2 views
    0 likes
    Last Post vibrationketousa  
    Started by hdge4u, Yesterday, 09:09 PM
    0 responses
    17 views
    0 likes
    Last Post hdge4u
    by hdge4u
     
    Started by hdge4u, Yesterday, 09:02 PM
    0 responses
    8 views
    0 likes
    Last Post hdge4u
    by hdge4u
     
    Started by stormcloudseven, Yesterday, 08:41 PM
    1 response
    9 views
    0 likes
    Last Post DavidTrades  
    Working...
    X