Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Conditional ATR Trailing Stop based on a multiplier Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
SweetAndSour
Posted : Tuesday, November 28, 2017 10:53:10 AM
Registered User
Joined: 5/26/2017
Posts: 25

Hi Teacher

May i ask you to translate the following code snippet (the conditional part only) into a conditional PCF Formula? Value[n] ist the current value of the TrailingStop Line...

 
if (Close[0] > Value[1] && Close[1] > Value[1])
    trail = Math.Max(Value[1], Close[0] - (ATR(5)[0] * 3.5));
else if (Close[0] < Value[1] && Close[1] < Value[1])
    trail = Math.Min(Value[1], Close[0] + (ATR(5)[0] * 3.5));
else if (Close[0] > Value[1])
    trail = Close[0] - (ATR(5)[0] * 3.5);
else
    trail = Close[0] + (ATR(5)[0] * 3.5);
 
AddPlot(new Stroke(Brushes.Orange, 2), PlotStyle.Line, "TrailingStop");
TrailingStop[0] = (trail);

Thanks for your help...

Bruce_L
Posted : Tuesday, November 28, 2017 10:58:07 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I really don't have a way of converting that into a formula. Have you looked at the Volatility Stop indicator with the Period set to 5 and the True Range Multiplier set to 3.5?



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
SweetAndSour
Posted : Tuesday, November 28, 2017 12:37:15 PM
Registered User
Joined: 5/26/2017
Posts: 25

QUOTE (Bruce_L)

I really don't have a way of converting that into a formula. Have you looked at the Volatility Stop indicator with the Period set to 5 and the True Range Multiplier set to 3.5?

I'll give it a try and do some backtesting.

Whats the Formula to check when the Volatility Switch changes from down trend to up trend?

Thanks

Bruce_L
Posted : Tuesday, November 28, 2017 1:05:48 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

There isn't a way to do it as a formula. Click on the indicator and select Create Scan Condition to check for price crossing up through the volatility stop indicator.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.