Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

best practice - considering multiple strategy instances

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

    best practice - considering multiple strategy instances

    is there a best practice rules in writing the strategy with consideration that it will be running simultaneously with different stock ?
    I have a strategy that sometimes (not always) fails to execute some commands in case it runs more than on 2-3 stocks at the same time .



    #2
    Hi dadarara, thanks for posting.

    Strategy instances are independent of each other. The best way to find out what a strategy is doing is to use Prints throughout OnBarUpdate to see if its reaching its conditions or not e.g.

    if(<condition to trade>)
    {
    Print("Condition Reached " + Time[0]);
    }

    More documentation here:


    Kind regards,
    -ChrisL

    Comment


      #3
      Thanks Chris
      I have multitude of Print commands , this doesn't help.
      because for example I see the print that notify me that the order was sent ( the code has submit the order) but I dont see any order active. the OnOrderUpdate is not triggered at all.
      what I mean is that I dont experience a particular problem in logic of the strategy. if I run it as one instance on one stock, it works great no issues.
      but if I run it on two different stocks than the problems start .
      I am not very experienced programmer, so I was thinking in the direction of variables declaration , private public functions etc..
      and thats why I asked if there are some specific rules that I need to follow in case that I want to run the same strategy several times simultaneously.


      Comment


        #4
        Hi dadarara,

        First, turn on TraceOrders = true; within State.SetDefaults and monitor the output window for any ignored orders. Running the strategy on two different instruments at the same time should not cause any issue, and a position on one instrument would not cause an order on a different instrument to be ignored. Please send me your log and trace files to scriptingsupport at ninjatrader.com as well:

        You can do this by going to the Control Center-> Help-> Email Support

        Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

        Please reference the following ticket number in the body of the email: 3219584 Attn ChrisL


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 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