# MultiCharts ATR vs. NT ATR  [SOLVED]

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 186
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 65 times
Been thanked: 10 times

### MultiCharts ATR vs. NT ATR

I'm trying to emulate an ATR-based trailing stop in a NinjaTrade black box indicator (I can't see the code). The basic issue appears to be that NT's and MultiChart's ATR calculation produce quite different results.

Any ideas why this might be? ATR should be a really straight-forward calculation and the NT ATR code looks like it does what I'd expect it to do.
Attachments
NinjaTrade_ATR_code.png (13.57 KiB) Viewed 643 times
NinjaTrader_5R_chart.png (67.25 KiB) Viewed 641 times
MultiCharts_5R_chart.png (42.2 KiB) Viewed 640 times

Posts: 353
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

### Re: MultiCharts ATR vs. NT ATR

I'm not sure if this is your reason for concern, but one reason why the indicator on the charts may look different is (I'm guessing) that the axis on MultiCharts is set to some minimal incremental value - so it isn't plotting the indicator at the level of precision that NT is. This does not mean, however, that it is necessarily calculating it incorrectly (although it could be).

If you want to check to make sure when MultiCharts is calculating the average true range correctly, I would do the following:

1) Use a Print command to show the TrueRange for the last bar on the chart and manually verify that it is correct. That is, use:

Code: Select all

`IF LASTBARONCHART = TRUE THEN BEGIN      Print(NumToStr(TrueRange,5); // The second number here is the precision to be displayedEnd;`

2) If you pass test #1, I would then print out the TrueRange for each bar as follows ...

PRINT(DATE,",",TIME,",",NumToStr(TrueRange,5);

... and then copy and paste the results into Excel or some other spreadsheet program and average them for the last bar (going back as far as you want). Compare this to the final ATR value calculated by MultiCharts to confirm whether it is correct.
These users thanked the author furytrader for the post (total 2):
TJPD Quig

SP
Posts: 453
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 283 times

### Re: MultiCharts ATR vs. NT ATR  [SOLVED]

The Summation of the True Range is a bit different in NJ and MC/TS.

This gives the NT ATR in MC:

Code: Select all

`inputs:   ATRLength( 14 );variables:   NinjaTrueRange ( 0 ),   NinjaAtr ( 0 ) ;NinjaTrueRange = MaxList ( Absvalue(Low[0] - Close[1]) , MaxList ( High[0] - Low[0] , Absvalue ( High [0] - Close[1] ) ) );NinjaAtr = ((((  MinList(CurrentBar + 1, ATRLength) - 1) * NinjaAtr [1]) + NinjaTrueRange ) / ( MinList ( CurrentBar + 1, ATRLength )));plot1(NinjaAtr );`
These users thanked the author SP for the post (total 5):

PD Quig
Posts: 186
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 65 times
Been thanked: 10 times

### Re: MultiCharts ATR vs. NT ATR

Thanks Fury and SP. I don't read C# so I missed that the summation is different. Awesome catch, SP. I'll try that after session close today.

PD Quig
Posts: 186
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 65 times
Been thanked: 10 times

### Re: MultiCharts ATR vs. NT ATR

Results. Thanks again, SP.
Attachments
NinjaTrader_ATR_vs_MultiCharts_ATR.png (49.04 KiB) Viewed 660 times