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

Trail Stops for Strategy Builder

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

    Trail Stops for Strategy Builder

    Is there any way someone could give me the instructions to put an trailing stop for my automated strategy with TRAIL STOP, TRAIL TRIGGER, TRAIL PRICE, AND TRAIL FREQUENCY. I want to set the stop @16 ticks, trigger @ 8 ticks, trail behind price @ 12 ticks, and have a frequency of 2 ticks. I cant figure out how to do that in strategy builder. Thank you.

    #2
    Hello misterbehm3,

    Thank you for reaching out.

    My colleague Chelsea has created the TrailBuilderExample_NT8 for the Strategy Builder that may be found at the following link:


    The example uses the variables TrailFrequency, TrailStopDistance, CurrentTriggerPrice, and CurrentStopPrice in the actions and conditions to create a trailing stop. You may view this strategy in the strategy builder by downloading the file at that link then going to Control Center > Tools > Import > NinjaScript AddOn. Select the downloaded file. Now the strategy will be an option to select in the Strategy Builder.

    Please let us know if we may be of further assistance.
    Emily C.NinjaTrader Customer Service

    Comment


      #3
      I have seen that post and reply many times on the forum. It only has the stop strategy for a long position. How do I set it up for long and short in the same strategy? Thanks

      Comment


        #4
        Hello misterbehm3,

        That sample is only made for 1 side so that the concept can be easily explained. You would need to add new sets for short trades and also other sets for the trail movements.

        I would suggest to make just a long side strategy and make sure you 100% understand what each set is doing before trying to add short side code. Once you feel 100% confident you know what each set is doing, create a new empty strategy and rebuild it in the exact same way but for the short side. Then test the short side strategy and make sure that does shorts how you expect. After that you could make a third strategy that combines both sides.

        The sample requires all 4 sets to do the trailing just for the long side which is going to need to be duplicated for the short side. You will have to make individual variables for both the long and short side code that are independent. Set 1 would still be used to reset variables but you would need to make 3 new sets for the short side which work independently of the existing 3 sets.

        The main take away from that sample would be how the CurrentTriggerPrice and CurrentStopPrice variables are used. Those variables are used to control how the trailing happens. The 4th set is also important, each bar where the CurrentStopPrice is set the order is resubmitted so it can continue to be updated and stay active. ​
        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by watson11, Today, 01:32 AM
        0 responses
        1 view
        0 likes
        Last Post watson11  
        Started by watson11, Today, 01:32 AM
        0 responses
        1 view
        0 likes
        Last Post watson11  
        Started by watson11, Today, 01:30 AM
        0 responses
        3 views
        0 likes
        Last Post watson11  
        Started by faisal00, Today, 12:34 AM
        0 responses
        2 views
        0 likes
        Last Post faisal00  
        Started by faisal00, Today, 12:33 AM
        0 responses
        1 view
        0 likes
        Last Post faisal00  
        Working...
        X