Announcement

Collapse
No announcement yet.

Defining a trailing stop in formula wizard

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

  • Defining a trailing stop in formula wizard

    Assume I'm long, I'd like a trailing stop to be at the lowest low from the previous 20 bars. Can I do this in the formula wizard?

  • #2
    mhat
    You can do that by using the lower channel of the Donchian Study set to 20 periods
    Alex

    Comment


    • #3
      Thanks Alexis. I had a brain cramp. Another question for you please. In the formula wizard I have a stop set to

      Strategy.setStop(close() - vATR5.getValue(ATRStudy.ATR) * 3) .

      Obviously with the current formula I'll never get stopped out.

      What I'd like for the formula to do is the stop would always be the maximum value for the formula from the time I went long no matter when that maximum value occured while I was long.

      Comment


      • #4
        mhat
        You are most welcome
        As to your question you will not be able to do that using the Formula Wizard alone as it requires creating global variables which the Formula Wizard cannot do. You will need to write the necessary logic using the Editor (Tools-> EFS-> Editor).
        You can find a detailed example of how to set up a trailing stop in section 2.4 of the Back Testing Tutorial 2. I would also suggest that you go through the other Back Testing tutorials.
        Alex

        Comment

        Working...
        X