ATR Differences

Questions about MultiCharts .NET and user contributed studies.
ascales
Posts: 36
Joined: 06 Jan 2017
Has thanked: 4 times
Been thanked: 2 times

ATR Differences

Postby ascales » 06 Feb 2020

Hi there,

I am getting different numbers when calling the ATR function from either an indicator or a signal with identical setup on the same price series and the same chart window.

The call is:

Code: Select all

m_atr.Value = this.AverageTrueRange(atrlength);
Does anyone have any suggestions as to how I can resolve/troubleshoot this? Are there any known issues? Been staring at it all afternoon!

Thanks a lot.
A

ascales
Posts: 36
Joined: 06 Jan 2017
Has thanked: 4 times
Been thanked: 2 times

Re: ATR Differences

Postby ascales » 07 Feb 2020

Hi again,

So it appears the difference is caused when turning on Bar Magnifier. I am using a 15 minute bar with Trade data plotted on the main chart; and additional data sources for Bid and Ask series. All indicators are using the Trade data source. LMAX is the data provider in this case.

I have tried modifying my strategy to:

Code: Select all

if (Bars.Status == EBarState.Close) { m_atr.Value = this.AverageTrueRange(atrlength); }
This makes no difference.

Assuming the ticks all fall within the range of the bar and the close is the same, why am I seeing a difference? This issue can be observed by placing any indicator on a chart and comparing the data window value to that of the strategy logged value with Bar Magnifier turned off and then on.

Thanks for any input from anyone... ;)

A

User avatar
Anna MultiCharts
Posts: 560
Joined: 14 Jul 2017
Has thanked: 42 times
Been thanked: 140 times

Re: ATR Differences

Postby Anna MultiCharts » 13 Feb 2020

Hello, ascales!

To be able to advise you anything we need to have your complete setup. Please send your workspace, data for the symbol used (in QMD format), the indicator and signal with all dependent functions as a PLN archive by email.
Also please specify the exact procedure that needs to be done to replicate the behavior that you observe. Some screenshots of the issue will also be useful.

ascales
Posts: 36
Joined: 06 Jan 2017
Has thanked: 4 times
Been thanked: 2 times

Re: ATR Differences

Postby ascales » 22 Feb 2020

Thanks for the response; I can live with this using 1 minute tick data in the bar magnifier. Maybe a nuance of my setup... thnx

gpw797
Posts: 216
Joined: 04 Mar 2006
Has thanked: 3 times
Been thanked: 7 times

Re: ATR Differences

Postby gpw797 » 22 Feb 2020

I have noticed the same thing. In some of my strategies I use ATR to determine allocation size and the calculations are always a little off.

biffhero
Posts: 47
Joined: 22 Sep 2020
Has thanked: 29 times
Been thanked: 7 times

Re: ATR Differences

Postby biffhero » 25 Sep 2020

@gpw797,

Is this a cross-platform issue, where you are using the MC-special ATR, instead of the Wilders' ATR and trying to compare the outputs with different calculations?

I looked at the code for the indicator "Average True Range", and it has this line in it:

Code: Select all

var0 = AvgTrueRange( ATRLength ) ;
and in the function AvgTrueRange, the following:

Code: Select all

AvgTrueRange = Average( TrueRange, Len ) ;
and the function Average() is clearly a Simple Average, not an EMA as found elsewhere.

1. Wilders' book has an EMA(7) on page 23.
2. Wikipedia uses an EMA
3. Wikipedia references the Wilders book and an article on "earnforex.com"
4. The article on earnforex uses an EMA.

As far as I have been able to find, the official MC position is found here viewtopic.php?t=45807#p100669 . If there is a different official MC position somewhere, I would like to know it.

Thank you,
Rob


Return to “MultiCharts .NET”