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

Questions about MultiCharts .NET and user contributed studies.
Emmanuel
Posts: 313
Joined: 21 May 2009
Has thanked: 93 times
Been thanked: 24 times

### Can we have access to the code of the function ?

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
CaptureA3.JPG
CaptureA2.JPG
CaptureA1.JPG

Emmanuel
Posts: 313
Joined: 21 May 2009
Has thanked: 93 times
Been thanked: 24 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
CaptureIndicateur.JPG

Emmanuel
Posts: 313
Joined: 21 May 2009
Has thanked: 93 times
Been thanked: 24 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
Capture Indicator.JPG

Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2942 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: 313
Joined: 21 May 2009
Has thanked: 93 times
Been thanked: 24 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