Download MetaTrader 5
To add comments, please log in or register
Register as a seller and start making profit!
sunshineh
1077
sunshineh 2016.10.27 15:56 

Hi,

The values from the lines are in buffers. How can I calulate and draw an average line from each line?

Fernando Carreiro
2245
Fernando Carreiro 2016.10.27 18:25  

Please be more clear!

  • Are you wishing to modify the original Indicator, in order to also show the average?
  • Are you wishing just to calculate the average in a separate Indicator using the results of iCustom() for the base indicator in question?

If the former, just add more buffers and calculate the Moving Average in the same way used in the example code "Custom Moving Averages.mq4" in the Indicators folder.

If the latter, then you can use the same example code, but use iCustom() to obtain the data from the base indicator.

sunshineh
1077
sunshineh 2016.10.28 07:17  

I want to see the lines not with the steps, I want to see it as continous line.

The best would be I can calculate the average price beween the last 2/3 different prices.

How can I do that calculation in a good way, so that the indicators hasn't work to much.

Keith Watford
Moderator
9555
Keith Watford 2016.10.28 07:27  
iMAOnArray()
sunshineh
1077
sunshineh 2016.10.28 07:51  

Thanks, but it isn't working. I tried:

double test =iMAOnArray(PDailyBuffer,0,3,0,MODE_SMA,0);

And PDailyBuffer is my indicator buffer from that line. But the variable test is always EMPTY_VALUE
even I can see the PDailyBuffer line.

Keith Watford
Moderator
9555
Keith Watford 2016.10.28 10:42  
Are you filling the PDailyBuffer before calling iMAOnArray ?
Fernando Carreiro
2245
Fernando Carreiro 2016.10.28 11:06  
sunshineh:

I want to see the lines not with the steps, I want to see it as continous line.

The best would be I can calculate the average price beween the last 2/3 different prices.

How can I do that calculation in a good way, so that the indicators hasn't work to much.

I think you don't understand what a Multi-Time-frame (MTF) Indicator is. If it is representing data from higher time-frames, then it will always be in "steps".

You can only get around that, if the type of indicator can be calculated with equivalent representation based on lower time frame data, but in that case you don't need to use the MTF indicator.

For example, a MTF Moving Average of a Daily time-frame shown on an H1 time-frame can be approximated by multiplying the period with the time-frame ratio. So if your are using a MA(9) on the daily then the equivalent on the H1 is an MA(216) where 216 = 9 * 24 (hours in a day). However, this is only possible if the indicator calculation lends itself to this sort of equivalent approximations. For the rest, there are the standard "stepped" MTF indicators.
/
To add comments, please log in or register