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...
|
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
|
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
|
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
|