Can we have access to the code of the function ?  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
Emmanuel
Posts: 303
Joined: 21 May 2009
Has thanked: 83 times
Been thanked: 22 times

Hi,

I am using Mov_Avg_1_Line indicator,

I check results of the AverageFC function, I found some annoying difference number in my code :

The best way to see it is to make an average of 1 bars:

As you can know it is an average of the last close bar.

We should find as the results, Average bar.close = close , but the result is different as you can see on the capture results.

Would it be possible to fix the function ?

Emmanuel
Attachments
CaptureA4.JPG (84.43 KiB) Viewed 992 times
CaptureA3.JPG (71.54 KiB) Viewed 983 times
CaptureA2.JPG (88.27 KiB) Viewed 963 times
CaptureA1.JPG (83.01 KiB) Viewed 955 times

Emmanuel
Posts: 303
Joined: 21 May 2009
Has thanked: 83 times
Been thanked: 22 times

Re: Can we have access to the code of the function ?

Hi

I found a difference of results between a signal and an indicator for the same function : AverageFC

See the attached files : at the last line : VAR2(1) : AverageFC

Why a difference of results between a signal and an indicator ?

If we have access to the source code, we will able to find the reason.

Emmanuel
Attachments
CaptureSignal.JPG (31.37 KiB) Viewed 971 times
CaptureIndicateur.JPG (31.62 KiB) Viewed 975 times

Emmanuel
Posts: 303
Joined: 21 May 2009
Has thanked: 83 times
Been thanked: 22 times

Why the results between signal and indicator different ?

Hi

Why are the results between a signal and an indicator different for the same function ?

For exemple :

if we use AverageFC as an indicator then as a signal, the results are a little bit different

In the attached file, you can see the AverageFC, is represented by Var3(0)

(I get the some difference with Mov Average Adaptive as well Var3(3))

The Close Var1(3) is the same for the signal and indicator , so why the results are different ?

Emmanuel
Attachments
Capture Signal.JPG (68.52 KiB) Viewed 969 times
Capture Indicator.JPG (67.05 KiB) Viewed 973 times

Henry MultiСharts
Posts: 9093
Joined: 25 Aug 2011
Has thanked: 1258 times
Been thanked: 2923 times

Re: Can we have access to the code of the function ?  [SOLVED]

Hello Emmanuel,

this.Bars.Close return the price value according to the price scale of your chart.
m_avg.Value returns the calculated average value using double values.
In math the following expression is always true A == ( A / B ) * B, but when you use double values for calculation the expression can be no longer true (the price difference you have shown on your screenshots). To learn more about Double class values peculiarities please refer to this page for more details.
If you round the m_avg.Value to the amount of digits after decimal you have for your instrument then m_avg.Value will be equal to this.Bars.Close.

AverageFC function source code is available in PowerLanguage .Net Editor in MultiCharts 8.5

Emmanuel
Posts: 303
Joined: 21 May 2009
Has thanked: 83 times
Been thanked: 22 times

Re: Can we have access to the code of the function ?

Hello Henry,

I didn't know this
this.Bars.Close return the price value according to the price scale of your chart.
m_avg.Value returns the calculated average value using double values.
In math the following expression is always true A == ( A / B ) * B