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:	154
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 argusthome, 03-08-2026, 10:06 AM
                  0 responses
                  61 views
                  0 likes
                  Last Post argusthome  
                  Started by NabilKhattabi, 03-06-2026, 11:18 AM
                  0 responses
                  40 views
                  0 likes
                  Last Post NabilKhattabi  
                  Started by Deep42, 03-06-2026, 12:28 AM
                  0 responses
                  21 views
                  0 likes
                  Last Post Deep42
                  by Deep42
                   
                  Started by TheRealMorford, 03-05-2026, 06:15 PM
                  0 responses
                  23 views
                  0 likes
                  Last Post TheRealMorford  
                  Started by Mindset, 02-28-2026, 06:16 AM
                  0 responses
                  51 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Working...
                  X