- ago
10559-Preferences-in-WL-pdf

How does WL calculate the ATR?

I have selected a trailing ATR of 6, 3.00 as per the attached screenshot.

If I plot an ATR of 6, 3.00 on the chart, it is a different price to what the preference command is producing. So I am thinking it must be calculated differently, so how is it calculated and can I change how it is calculated?
0
349
4 Replies

Reply

Bookmark

Jump to End
Cone8
- ago
#1
You're showing the use of the TASC ATRTrail indicator for % Risk Sizing. TASC indicators are documented by their articles in the magazine. Sadly our documentation doesn't even indicate which issue this one's from, so here's the code that populates the indicator.

CODE:
public override void Populate() { BarHistory source = Parameters[0].AsBarHistory; Int32 period = Parameters[1].AsInt; Double factor = Parameters[2].AsDouble; DateTimes = source.DateTimes; //ATR ATR atr = new ATR(source, period); //calculate ATR Trailing Stop for (int n = period; n < source.Count; n++) { double loss = factor * atr[n]; if (source.Close[n] > Values[n - 1] && source.Close[n - 1] > Values[n - 1]) Values[n] = Math.Max(Values[n - 1], source.Close[n] - loss); else if (source.Close[n] < Values[n - 1] && source.Close[n - 1] < Values[n - 1]) Values[n] = Math.Min(Values[n - 1], source.Close[n] + loss); else Values[n] = source.Close[n] > Values[n - 1] ? source.Close[n] - loss : source.Close[n] + loss; } }
If you're looking for a straight ATR calculation for your Max Risk Sizing, you should do it yourself using the MathIndOpInd indicator.
0
Cone8
- ago
#2
p.s. ATRTrail was from the June 2009 issue of TASC magazine.
https://traders.com/Documentation/FEEDbk_docs/2009/06/Vervoort.html
0
- ago
#3
QUOTE:
ATRTrail was from the June 2009 issue of TASC magazine.

If the ATRModified and ATRTrail indicators are both from the same TASC issue, then how are they different?
0
Cone8
- ago
#4
ATRModified is an inconsecuential modification (imho) of ATR.
ATRTrail is a value you can use for a SAR strategy.
1

Reply

Bookmark

Jump to Top