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

StopLoss with Multi-Time Frame Strategy

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

    StopLoss with Multi-Time Frame Strategy

    Hello NT Support,

    I develop a strategy with one instrument, day bars and minute bars. I use stop loss orders.

    The orders with minute bars depend on orders with day bars. Since day and minute bars are with one and the same instrument, I use OnExecution method and string variables to track market positions.

    I need to know where StopLoss order is executed - on day bars or on minute bars. How can I know it?

    Thanks

    #2
    Valyo, I would suggest 'tagging' the BarsInProgress you submit to / on with the signal name of your orders, you can then in turn check this property of the IOrder processed by other parts of your code.

    BertrandNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Bertrand View Post
      Valyo, I would suggest 'tagging' the BarsInProgress you submit to / on with the signal name of your orders, you can then in turn check this property of the IOrder processed by other parts of your code.
      Bertrand, this doesn't work.
      I used

      Code:
      Print(execution.ToString());
      Print(execution.Order.FromEntrySignal);
      to debug the script.

      Here is the output for regular exit order:

      Execution='NT-00380' Instrument='$AUDNZD' Account='Backtest' Name='Exit Minute Long' Exchange=Default Price=1,2044 Quantity=0,1M Market position=Short Commission=0 Order='NT-00571' Time='4.6.2013 г. 23:00 ч.' Multiplier=1E-05
      Enter Minute Long
      Here "Enter Minute Long" is FromEntrySignal.

      Here is the output for stop loss order:

      Execution='NT-00381' Instrument='$AUDNZD' Account='Backtest' Name='Stop loss' Exchange=Default Price=1,195 Quantity=0,1M Market position=Short Commission=0 Order='NT-00565' Time='5.6.2013 г. 15:00 ч.' Multiplier=1E-05
      There is no FromEntrySignal, just a blank line. It seems I cannot access FromEntrySignal with Stop loss orders. Is there another way to track entry orders?

      Comment


        #4
        Hello,

        Are you currently using SetStopLoss() to place your stop loss orders? If so keep in mind that the set methods only get applied to the primary series for the instrument.

        Is there a simple sample script that you can post which replicates the issue you're seeing?
        LanceNinjaTrader Customer Service

        Comment


          #5
          Yes, I am using SetStopLoss. My primary series is with minute bars and the additional series is with day bars. How can I apply stop loss to the additional series for the instrument?

          Comment


            #6
            Hello,

            In this case you will not be able to use SetStopLoss()

            You will have to use IOrders for your order tracking.

            This is a good starting guide and example if you haven't worked with IOrders before. It shows how you can apply your exit orders in OnExecution(): http://www.ninjatrader.com/support/f...ead.php?t=7499

            Let me know if I can be of further assistance.
            LanceNinjaTrader Customer Service

            Comment


              #7
              OK, thank you. I will check it.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by marcus2300, Today, 10:21 AM
              3 responses
              6 views
              0 likes
              Last Post RaddiFX
              by RaddiFX
               
              Started by chemo, Today, 12:05 PM
              0 responses
              1 view
              0 likes
              Last Post chemo
              by chemo
               
              Started by DawnTreader, 05-08-2024, 05:58 PM
              12 responses
              42 views
              0 likes
              Last Post DawnTreader  
              Started by sofortune, Today, 10:28 AM
              4 responses
              11 views
              0 likes
              Last Post sofortune  
              Started by Haiasi, 04-25-2024, 06:53 PM
              6 responses
              82 views
              0 likes
              Last Post joselube001  
              Working...
              X