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

Make a strategy that exits a position after a specific amount of time

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

    Make a strategy that exits a position after a specific amount of time

    Is it possible to make a command in Strategy Builder that will exit a trade after a certain amount of time has passed since entry? For example, if my strategy has entered a trade, and the position is still open after one hour, I want the strategy to exit the trade for me.

    #2
    I don't think that it is possible, if you use OnBarUpdate. But if moderators would tell otherwise, I am eager to find out how.

    Comment


      #3
      Hello erin_l,

      Welcome to the forums!

      This would not be possible in the Strategy Builder since the Strategy Builder is limited to event based Bar Updates. Your logic is processed as bars are formed (and tick data is received to form these bars.)

      It is possible to incorporate a timer in unlocked scripts to achieve time delayed events. An example indicator that incorporates a timer can be found below, and another is attached. The same logic could be implemented in a strategy if you wish.



      We look forward to assisting.
      Attached Files
      JimNinjaTrader Customer Service

      Comment


        #4
        Thank you for the information. I am wondering if I can make a strategy read two different charts at once. For example, if I have a strategy which trades on the 2000 tick chart, could I add part of the strategy to exit trades based on the minute chart? Or if I have a strategy that only enters trades on the 2000 tick chart, could I make a separate strategy that exits trades based on the minute chart?

        Comment


          #5
          Hello erin_l,

          Strategies only know about the data series they are added to or the data series' that are added within the strategy itself.

          Strategy Builder strategies can only process logic in Conditions and Actions based on the data series we apply the strategy to, but additional data can be added and used in the strategy logic. Indicators can be based off of the additional data and logic can be written to reference the additional data. Additional data can be added in the Additional Data page of the Strategy Builder.

          That data can then be referenced in an Indicator's Input Series, or the Series property for a PriceSeries like Open, High, Low, or Close.

          If you would like to process logic as the additional data series update, you can unlock the code and follow our Multi time Frame and Instrument documentation.

          Multi time Frame and Instruments - https://ninjatrader.com/support/help...nstruments.htm

          Please let us know if you have any questions.
          JimNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by andrewtrades, Today, 04:57 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by chbruno, Today, 04:10 PM
          0 responses
          5 views
          0 likes
          Last Post chbruno
          by chbruno
           
          Started by josh18955, 03-25-2023, 11:16 AM
          6 responses
          436 views
          0 likes
          Last Post Delerium  
          Started by FAQtrader, Today, 03:35 PM
          0 responses
          7 views
          0 likes
          Last Post FAQtrader  
          Started by rocketman7, Today, 09:41 AM
          5 responses
          19 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X