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

Strategy with trailing stop based on high/low of previous bar +- some input value

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

    Strategy with trailing stop based on high/low of previous bar +- some input value

    I am attempting to build a strategy with a trailing stop that is based on the High/Low (short position/long position) of the previous bar +- some input value. I can't see any coding method for that within the strategy builder stop and target section. Is this possible and can you provide me some examples of how it would be coded

    #2
    Hello gjbeaudin,

    Thank you for your inqiry.

    The Set methods in the Stops and Targets section of the Strategy Builder only allow for simple stops and targets that cannot be changed dynamically. Programming by hand will offer more flexibility, but you can also create your own logic in Conditions and Actions that controls how you would like to exit.

    We can not offer services to design strategy logic in the support department, but you may conceptualize the following as an example of using Exit orders to mimic Trail stop functionality:
    1. If the strategy is flat, set a bool to controlling your auto trail behaviors to false. Then Enter.
    2. If the strategy is not flat and some condition happens that you would like to trigger your auto trail, set the bool to true.
    3. If the strategy is not flat and the bool is false, place your initial stop loss as an Exit Order.
    4. If the strategy is not flat and the bool is true, modify the Exit Order in association to the current market price.
    More information on using the Strategy Builder can be found below.

    Strategy Builder 301 - https://www.youtube.com/watch?v=HCyt90GAs9k

    I'm also attaching a basic example of setting this functionality up in the Strategy Builder.

    Please let us know if we may be of further assistance to you.
    Attached Files
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by gjbeaudin View Post
      I am attempting to build a strategy with a trailing stop that is based on the High/Low (short position/long position) of the previous bar +- some input value. I can't see any coding method for that within the strategy builder stop and target section. Is this possible and can you provide me some examples of how it would be coded
      Don't know if you ever found a solution, but both of these use different methods but do what you are asking:

      1) https://ninjatraderecosystem.com/use...bot-indicator/
      2) https://ninjatraderecosystem.com/use...er-entry-v4-2/

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Taddypole, 04-26-2024, 02:47 PM
      1 response
      10 views
      0 likes
      Last Post NinjaTrader_Eduardo  
      Started by futtrader, 04-21-2024, 01:50 AM
      6 responses
      58 views
      0 likes
      Last Post futtrader  
      Started by sgordet, Today, 11:48 AM
      0 responses
      4 views
      0 likes
      Last Post sgordet
      by sgordet
       
      Started by Trader146, Today, 11:41 AM
      0 responses
      5 views
      0 likes
      Last Post Trader146  
      Started by jpapa, 04-23-2024, 07:22 AM
      2 responses
      19 views
      0 likes
      Last Post rene69851  
      Working...
      X