Convert "ATR Trailing Stop" of ThinkorSwim
Author: marron
Creation Date: 4/6/2011 7:25 PM
profile picture

marron

#1
Please help to convert the below code, from ThinkorSwim into WL.net.

Thank a lot.



CODE:
Please log in to see this code.
profile picture

Cone

#2
You might have better luck just posting the rules in English.

Does this happen to be Vervoot's modified ATR stop from TASC magazine June 2009? Note that this solution is for discretionary trading, per the article.
profile picture

DartboardTrader

#3
Funny timing, I just implemented this over last weekend.

The output compares almost identically to what I see in TOS Desktop. The difference may be in the EMA implementations on TOS vs WL.

Enjoy!
--Mike

CODE:
Please log in to see this code.
profile picture

Eugene

#4
Mike,

I guess that this is unconditionally false:
CODE:
Please log in to see this code.

By definition, NaN is equal to nothing, and NaN even != NaN. Try this:
CODE:
Please log in to see this code.
profile picture

Cone

#5
Here's another way to do the job based on the Wealth-Lab code in the Traders' Tip that I mentioned previously.

CODE:
Please log in to see this code.
profile picture

marron

#6
Wonderful. Thank A LOT to Mike, Cone, & Eugene.