int PRICE_GD_OPEN = iMA(_Symbol, PERIOD_CURRENT, 10, 0, MODE_SMA, PRICE_OPEN); int GD = iTEMA(_Symbol, PERIOD_CURRENT, 4, 0, PRICE_GD_OPEN); : : CopyBuffer(GD, 0, 0, rates_total, TEMA_Buffer);
Thank you. Still I do not know how to make it run.
int PRICE_GD_OPEN = iMA(_Symbol, PERIOD_CURRENT, 10, 0, MODE_SMA, PRICE_OPEN); int GD = iTEMA(_Symbol, PERIOD_CURRENT, 4, 0, PRICE_GD_OPEN);
Both are handles. But
PRICE_GD_OPEN
in the iTEMA handle function as the last value should be entered as double value. But this double value is available only after CopyBuffer in OnTick and not yet in OnInit operation.
Entering
CopyBuffer(GD, 0, 0, rates_total, TEMA_Buffer);adapted as
CopyBuffer(GD_handle, 0, 0, 100, GD);
only shows errors:
http://michaelneubert.net/error.jpg
I feel unable to bring the routines in a right order:
double GD[]; int GD_handle; // handle of the indicator iTEMA double PRICE_GD_OPEN[]; int PRICE_GD_OPEN_handle; // handle of the indicator iMA int OnInit { PRICE_GD_OPEN = iMA(_Symbol, PERIOD_CURRENT, 10, 0, MODE_SMA, PRICE_OPEN); GD_handle = iTEMA(_Symbol, PERIOD_CURRENT, 4, 0, PRICE_GD_OPEN[]); } void OnTick() { CopyBuffer(GD_handle, 0, 0, 100,GD); CopyBuffer(PRICE_GD_OPEN_handle,0,0,100,PRICE_GD_OPEN); ArraySetAsSeries(PRICE_GD_OPEN,true);
Can you help please?
Both are handles. But
in the iTEMA handle function as the last value should be entered as double value. But this double value is available only after CopyBuffer in OnTick and not yet in OnInit operation.
iTEMA
The function returns the handle of the Triple Exponential Moving Average indicator. It has only one buffer.
int iTEMA( |
applied_price
[in] The price used. Can be any of the price constants ENUM_APPLIED_PRICE or a handle of another indicator.
What double value are you talking about?
The applied price or another indicator handle value will be entered here.
double GD[]; int GD_handle; // handle of the indicator iTEMA //double PRICE_GD_OPEN[]; int PRICE_GD_OPEN_handle; // handle of the indicator iMA int OnInit { PRICE_GD_OPEN_handle = iMA(_Symbol, PERIOD_CURRENT, 10, 0, MODE_SMA, PRICE_OPEN); GD_handle = iTEMA(_Symbol, PERIOD_CURRENT, 4, 0, PRICE_GD_OPEN_handle); } void OnTick() { CopyBuffer(GD_handle, 0, 0, 100, GD); //CopyBuffer(PRICE_GD_OPEN_handle,0,0,100,PRICE_GD_OPEN); //ArraySetAsSeries(PRICE_GD_OPEN,true);
- www.mql5.com
Thank you so much, I have been not aware about your outpointed details. It runs smoothly changing
int OnInit
to
void OnInit()What does this change (substantially) ? I am not aware of the difference.
Thank you so much, I have been not aware about your outpointed details. It runs smoothly changing
to What does this change (substantially) ? I am not aware of the difference.I also had copied the whole thing without realizing this.
Without the parentheses, it would not be recognized as a function and should result in an error.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Nesting of MQL5 handles as iMA and iTEMA is not possible. I would need the Triple Exponential Moving Average of a Moving Average e.g.:
How can I realize this?