Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Builder - How to set a Trailing Stop

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

    Strategy Builder - How to set a Trailing Stop

    Using Strategy Builder, how do I add a trailing stop to a strategy that uses candle close above/below a moving average for the entry? Trailing stop doesn't work when I have selected "on bar close" for the strategy. If I change the strategy to "on price change" my entry criteria doesn't work properly. (enters a trade on every price change instead of the candle close after the cross/close). Is there a way to get these two items to work on the same strategy? Thanks

    #2
    Hello kgroupllc,

    You can add to your entry condition the following to have it simulate OnBarClose:

    Left: Misc -> Is first tick of bar
    Center: equals
    Right: Misc -> True

    That will let the trailing stop update on each price change and the entry only when the bar closes, the first tick is the same tick that closes the bar.

    Comment


      #3
      Thanks Jesse. I added that to my entry criteria, and left the strategy "On Price Change", and the entries are not triggering. This is what I'm using: Click image for larger version

Name:	image.png
Views:	165
Size:	9.9 KB
ID:	1319623
      Thanks

      Comment


        #4
        Hello kgroupllc,

        Did the condition work before adding first tick of bar?

        Comment


          #5
          Yes, it worked prior to adding first tick of bar

          Comment


            #6
            Hello kgroupllc,

            Are you testing in realtime?

            The next step would be to use prints to see why that is blocking the condition from being true. IsFirstTickOfBar should always be true in historical and in realtime would have the effect that you wanted to simulate OnBarClose when using OnPriceChange.

            Comment


              #7
              actually that change to add IsFirstTickOfBar was added and tested in playback. I will try again on SIM in real time

              Comment


                #8
                Hello kgroupllc,

                That should also work in playback if you have the script set to OnPriceChange or OnEachTick and are playing forward. If its not I would suggest using a Print to output all of the values used in the condition to see if on the first tick of the bar if that specifically is the problem or if one of the other values is not in the correct range for the condition to become true at that time. There is a video linked below that goes over adding prints into builder scripts.

                Comment


                  #9
                  Thanks, I'll try that

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Hwop38, 05-04-2026, 07:02 PM
                  0 responses
                  161 views
                  0 likes
                  Last Post Hwop38
                  by Hwop38
                   
                  Started by CaptainJack, 04-24-2026, 11:07 PM
                  0 responses
                  310 views
                  0 likes
                  Last Post CaptainJack  
                  Started by Mindset, 04-21-2026, 06:46 AM
                  0 responses
                  245 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by M4ndoo, 04-20-2026, 05:21 PM
                  0 responses
                  350 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Started by M4ndoo, 04-19-2026, 05:54 PM
                  0 responses
                  179 views
                  0 likes
                  Last Post M4ndoo
                  by M4ndoo
                   
                  Working...
                  X