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

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
    Chris L.NinjaTrader Customer Service

    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


        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by kempotrader, Today, 08:56 AM
        0 responses
        7 views
        0 likes
        Last Post kempotrader  
        Started by kempotrader, Today, 08:54 AM
        0 responses
        4 views
        0 likes
        Last Post kempotrader  
        Started by mmenigma, Today, 08:54 AM
        0 responses
        2 views
        0 likes
        Last Post mmenigma  
        Started by halgo_boulder, Today, 08:44 AM
        0 responses
        1 view
        0 likes
        Last Post halgo_boulder  
        Started by drewski1980, Today, 08:24 AM
        0 responses
        4 views
        0 likes
        Last Post drewski1980  
        Working...
        X