The error could be in the number of digits after the decimal point:
This is not the error, the data is not calculated on the history, but from the moment the symbol is created everything is calculated correctly, I suspect the history calculation function is not working correctly, i.e. it is a bug.
I have such a problem: I've just started in MT5, I'm transferring my indicators from MT4 and I've encountered some problems. I need to use iMA in one line and get the value of one specific index. I've seen messages on forum and use iMAGet function (as well as similar iATRGet etc.). As I see, the functions no longer work, then this question: how to gracefully get one single iMA value? I've tried using the above functions to do this:
I know it's bad without checking, but I have to port old MT4 code, I couldn't think of any other way to make it simpler (I have dozens of wizards, and they all work on different timeframes). I can't initialize the wizards in oninit, because the code has three steps nesting and I can't call the needed wizard without troubles. So, in short, my goal is to turn
I have a problem, I have just started MT5 and I have problems with it when I transfer my indicators from MT4. I need to use iMA in one line and get the value of one specific index. I've seen messages on forum and use iMAGet function (as well as similar iATRGet etc.). As I see, the functions no longer work, then this question: how to gracefully get one single iMA value? I've tried using the above functions to do this:
I know it's bad without checking, but I have to port old MT4 code, I couldn't think of any other way to make it simpler (I have dozens of wizards, and they all work on different timeframes). I can't initialize the wizards in oninit, because the code has three steps nesting and I can't call the needed wizard without troubles. So, in short, my goal is to turn
This :
Into something that works on MT5 without any drastic gestures.
handle_iMA_High=iMA(Symbol(),Period(),Inp_MA_ma_period,Inp_MA_ma_shift,
Inp_MA_ma_method,PRICE_HIGH);
//--- if the handle is not createdif(handle_iMA_High==INVALID_HANDLE)
{
//--- tell about the failure and output the error codePrintFormat("Failed to create handle of the iMA indicator (\"Price High\") for the symbol %s/%s, error code %d",
Symbol(),
EnumToString(Period()),
GetLastError());
//--- the indicator is stopped earlyreturn(INIT_FAILED);
}
Then you copy the necessary element(s) to the clipboard and work with it
if(CopyBuffer(ind_handle,0,-shift,amount,values)<0)
{
//--- if the copying fails, tell the error codePrintFormat("Failed to copy data from the iMA indicator, error code %d",GetLastError());
As I have already written, initialization in OnInit is not suitable for me. I have work with all timeframes simultaneously, I have to initialize all masks in each TF, and then in code, where I use some value, do something like this:
As I have already written, initialization in OnInit is not suitable for me. I have work with all timeframes simultaneously, I have to initialize all masks in each TF, and then in code, where I use some value, do something like this:
And so with every call of each wristband. The code will just turn into a tangled diarrhea.
And every new bar will need some way to update it?
Is there a function like CopyBuffer, but copying not an array, but a single value by the right index?
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into function for usability, feed it with indicator handle and required index from array, and function will return the price
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into a function for ease of use, pass the indicator handle and the required index from the array, and the function will return the price
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into function for usability, there you feed the indicator handle and the required index from the array, and the function will return the price
The other problem of CopyBuffer is that it necessarily requires the indicator buffer for itself. I have a hundred indicators in total and they are used in calculations to get one single indicator. Do I need to create a hundred buffers to store these values?
Another problem with CopyBuffer is that it necessarily requires an indicator buffer for itself. I have under a hundred indicators in total and they are used in calculations to get one single indicator. Do I need to create a hundred buffers to store these values?
Look for code examples in scriptor's CodeBase - everything is there.
I need an example to solve the following problem: there is an indicator ¹1 in the chart with a dozen graphical buffers (not wavecaps and other stuff) and the basement indicator ¹2 should take some buffers from the indicator ¹1 and display them as hixograms (no matter how) already in the basement. Thank you in advance, for MT5.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
The error could be in the number of digits after the decimal point:
I have such a problem: I've just started in MT5, I'm transferring my indicators from MT4 and I've encountered some problems. I need to use iMA in one line and get the value of one specific index. I've seen messages on forum and use iMAGet function (as well as similar iATRGet etc.). As I see, the functions no longer work, then this question: how to gracefully get one single iMA value? I've tried using the above functions to do this:
This :
Into something that works on MT5 without any drastic gestures.
Good afternoon, gentlemen.
I have a problem, I have just started MT5 and I have problems with it when I transfer my indicators from MT4. I need to use iMA in one line and get the value of one specific index. I've seen messages on forum and use iMAGet function (as well as similar iATRGet etc.). As I see, the functions no longer work, then this question: how to gracefully get one single iMA value? I've tried using the above functions to do this:
This :
Into something that works on MT5 without any drastic gestures.
Check out the examples in kodobase, such as this one:https://www.mql5.com/ru/code/27161
Basically: create an indicator handle in OnInit()
Then you copy the necessary element(s) to the clipboard and work with it
https://www.mql5.com/ru/docs/series/copybuffer
Look up examples in the kodobase, e.g. this one:https://www.mql5.com/ru/code/27161
Basically: Create indicator handle in OnInit()
Then you copy the necessary element(s) to the buffer and work with it
https://www.mql5.com/ru/docs/series/copybuffer
As I have already written, initialization in OnInit is not suitable for me. I have work with all timeframes simultaneously, I have to initialize all masks in each TF, and then in code, where I use some value, do something like this:
And so with every call of each wristband. The code will just turn into a confusing diarrhea.
And every new bar will need to update it somehow?
Is there a function like CopyBuffer, but copying not an array, but one value by required index?
As I have already written, initialization in OnInit is not suitable for me. I have work with all timeframes simultaneously, I have to initialize all masks in each TF, and then in code, where I use some value, do something like this:
And so with every call of each wristband. The code will just turn into a tangled diarrhea.
And every new bar will need some way to update it?
Is there a function like CopyBuffer, but copying not an array, but a single value by the right index?
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into function for usability, feed it with indicator handle and required index from array, and function will return the price
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into a function for ease of use, pass the indicator handle and the required index from the array, and the function will return the price
very inconvenient, though)
(it's awkward, though))
More like uncomfortable ))))
Make an array of handles inOnInit() and work with them.
CopyBuffer(...) into function for usability, there you feed the indicator handle and the required index from the array, and the function will return the price
The other problem of CopyBuffer is that it necessarily requires the indicator buffer for itself. I have a hundred indicators in total and they are used in calculations to get one single indicator. Do I need to create a hundred buffers to store these values?
Another problem with CopyBuffer is that it necessarily requires an indicator buffer for itself. I have under a hundred indicators in total and they are used in calculations to get one single indicator. Do I need to create a hundred buffers to store these values?