Hi Trucco,

Here is your code modified a little:

---------------------------

double iteration = 0;

int start()

{

iteration++;

double EMA4 = iMA(NULL, 1, 8, 0, MODE_EMA, PRICE_TYPICAL, 0);

double EMA5 = iMA(NULL, 1, 12, 0, MODE_EMA, PRICE_TYPICAL, 0);

Comment("\nEMA 8: ", EMA4, "\nEMA 12: ", EMA5, "\nIteration: ", iteration);

return(0);

}

---------------------------

The last parameter of iMA function is the shift relative to the current bar the given amount of periods ago. Now if you are interested to include the current running bar in your calculation then put 0 instead of 1. If you put 1 it is the previous bar.

I have replaced PRICE_CLOSED with PRICE_TYPICAL so you can see live how the EMA value changes as the bar size changes in realtime.

Also the second parameter is 1, this means you are using M1 timeframe, I hope this is what you intend.

And finally the iteration will tell you how many times the Start() function was called since the indicator was applied on the chart.

Just load it on a 1M chart and see how it chages. Hope it helps.

Here is your code modified a little:

---------------------------

double iteration = 0;

int start()

{

iteration++;

double EMA4 = iMA(NULL, 1, 8, 0, MODE_EMA, PRICE_TYPICAL, 0);

double EMA5 = iMA(NULL, 1, 12, 0, MODE_EMA, PRICE_TYPICAL, 0);

Comment("\nEMA 8: ", EMA4, "\nEMA 12: ", EMA5, "\nIteration: ", iteration);

return(0);

}

---------------------------

The last parameter of iMA function is the shift relative to the current bar the given amount of periods ago. Now if you are interested to include the current running bar in your calculation then put 0 instead of 1. If you put 1 it is the previous bar.

I have replaced PRICE_CLOSED with PRICE_TYPICAL so you can see live how the EMA value changes as the bar size changes in realtime.

Also the second parameter is 1, this means you are using M1 timeframe, I hope this is what you intend.

And finally the iteration will tell you how many times the Start() function was called since the indicator was applied on the chart.

Just load it on a 1M chart and see how it chages. Hope it helps.

-soso