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

How to get order status

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

    #16
    Hello vitaliys,
    You have to code your own logic while using a Exit() order just like what you have coded while entering an position using the Enter() methods.

    Both SetStopLoss and ExitLongStop() will submit a stop market orders.

    Also you cannot use the Set() and the Exit methods simultaneously as the internal order handling rules will reject the orders.



    Code:
    SetStopLoss("Order1", CalculationMode.Ticks, slSize, false);
    The above SetStopLoss overload will calculate the stop price based on the average price of the current position. So let suppose you are trading ES, and you got a long filled at 1400, if slSize is 4 then your stop will be placed at 1399. On the second trade, if the entry order is filled at say 1410 then the stop will be placed at 1409. If you want to change the stop loss size then you have to reassign the Set() order again.

    Yes, Exit codes can be used to exit a trade (either target or stop). Exit codes are more like Entry() codes and you have to enter your own logic unlike Set() orders which are internally handled by NinjaTrader.

    What you will use (Set or Exit methods) really depends on how you want to design your strategy.

    Please let me know if I can assist you any further.
    JoydeepNinjaTrader Customer Service

    Comment


      #17
      Thanks a lot for your help ! I was trying to use Strategy Analyzer and couldn't specify range for pre-defined parameters in drop down box. Is it possible to set it to go through the drop down menus in addition to normal integer values ?

      Comment


        #18
        Hello vitaliys,
        To assist you further may I know are you backtesting or optimizing a strategy.

        I look forward to assisting you further.
        JoydeepNinjaTrader Customer Service

        Comment


          #19
          I'm trying to optimize the strategy

          Comment


            #20
            Hello vitaliys,
            Unfortunately optimizing the drop down parameters like an enum or boolean values is not possible. As a workaround you can modify your code and set integer values for it and then optimize it.

            For example if your code has a boolean like

            Code:
            if (true)
            {
               //do something
            }
            else 
            {
              do something
            }
            Change it to
            in variable
            Code:
            int myBoolInt = 0;
            and test it as
            Code:
            if (myBoolInt == 0)
            {
               //do something
            }
            else if (myBoolInt == 1)
            {
               do something
            }
            Please let me know if I can assist you any further.
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by jeronymite, 04-12-2024, 04:26 PM
            3 responses
            39 views
            0 likes
            Last Post jeronymite  
            Started by bill2023, Today, 08:51 AM
            2 responses
            15 views
            0 likes
            Last Post bill2023  
            Started by sidlercom80, 10-28-2023, 08:49 AM
            167 responses
            2,260 views
            0 likes
            Last Post jeronymite  
            Started by warreng86, 11-10-2020, 02:04 PM
            7 responses
            1,362 views
            0 likes
            Last Post NinjaTrader_Manfred  
            Started by Perr0Grande, Today, 08:16 PM
            0 responses
            5 views
            0 likes
            Last Post Perr0Grande  
            Working...
            X