averageTrueRange not working correctly with BarsOfData2  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Emmanuel
Posts: 355
Joined: 21 May 2009
Has thanked: 109 times
Been thanked: 28 times

averageTrueRange not working correctly with BarsOfData2

Postby Emmanuel » 06 Mar 2015

Hi

I am developing a new indicator : averageTrueRange on the BarsOfData(2)

(see the attached example average_True_Range_BarsOfData2.pln)

but if I compare it, to the regular indicator averageTrueRange.

(if I put the regular indicator averageTrueRange manualy on barOfData 2)

I get a different results , see Capture.jpg attached.

The other indicator don't give this error.

Do you know why I have this difference with averageTrueRange?

Thank you


Emmanuel
Attachments
Capture.JPG
(192.83 KiB) Downloaded 855 times
average_True_Range_BarsOfData2.pln
(1.25 KiB) Downloaded 764 times

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: averageTrueRange not working correctly with BarsOfData2  [SOLVED]

Postby Henry MultiСharts » 19 Mar 2015

Hello Emmanuel,

Our engineer has corrected the study for you. Please find working code attached.
Attachments
average_True_Range_BarsOfData2_fix.pln
(1.25 KiB) Downloaded 674 times

Emmanuel
Posts: 355
Joined: 21 May 2009
Has thanked: 109 times
Been thanked: 28 times

Re: averageTrueRange not working correctly with BarsOfData2

Postby Emmanuel » 20 Mar 2015

Hello Henry

Thank you very much for your solution !!!! :) Thank you to the engineer team too !!!

It works !!!

I give the #datastream in sub create and sub calcbar and it work !!

I didn't know that we could write in the calcbar:

Code: Select all

m_atr.Value = this.AverageTrueRange(atrlength, 0, IndexMemoireBarsOfData);

2/ Do you know what for is 0 in this.AverageTrueRange above ? (int bb ?)

1/ Does it mean that we can change of datastream in Calcbar ? Or does it have to be the same as in create ?

Code: Select all

m_atr = new VariableSeries<Double>(this, IndexMemoireBarsOfData);
3/ Do you know , how many datastream we can have in one graphic ?

Best Regards to all your team !!!

Emmanuel

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: averageTrueRange not working correctly with BarsOfData2

Postby Henry MultiСharts » 26 Mar 2015

1/ Does it mean that we can change of datastream in Calcbar ? Or does it have to be the same as in create ?

Code: Select all

m_atr = new VariableSeries<Double>(this, IndexMemoireBarsOfData);
Yes, you can change it, but you should keep in mind that it cannot be changed on a fly for a series variable.
2/ Do you know what for is 0 in this.AverageTrueRange above ? (int bb ?)
bb - BarsBack - amount of bars for initial calculation. More info here.
3/ Do you know , how many datastream we can have in one graphic ?
Up to 100.


Return to “MultiCharts .NET”