Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010
Perhaps you should read the manual, especially the examples.
How To Ask Questions The Smart Way. 2004
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
Technical Indicators - Reference on algorithmic/automated trading language for MetaTrader 5
Timeseries and Indicators Access / CopyBuffer - Reference on algorithmic/automated trading language for MetaTrader 5
How to start with MQL5 - General - MQL5 programming forum - Page 3 #22 2020.03.08
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 2020.07.05
How to call indicators in MQL5 - MQL5 Articles 12 March 2010
Thanks William
I looked at all documentation you attached above.. precious and complete
but those documentation I already knew, infact I have several EAs that work well on many indicators,
I can not understand the case of Envelopes, why I do the following things ...
OnInit () ... handle = iEnvelopes (NULL, 0, period, 0, method, price, deviation); custom1handle = iCustom (NULL, 0, "indicator name", params ......, 0, handle); ArraySetAsSeries (arrayUpper, true); // Envelopes Upper Buffer ArraySetAsSeries (arrayLower, true); // Envelopes Lower Buffer ArraySetAsSeries (custom1array, true); // custom1array copying Upper Buffer ArraySetAsSeries (custom2array, true); // custom2array copying Lower Buffer ...
and so
OnTick () ... CopyBuffer (handle,0,0,3, arrayUpper)... to get arrayUpper "OK"; ...{Print ("Copy-arrayUpper error =", GetLastError ());} CopyBuffer (handle,1,0,3, arrayLower)... to get arrayLower "OK"; ... {Print ("Copy-arrayLower error =", GetLastError ());} // and when I try to handle the custom indicator on the two Envelopes buffers I get an error on the second buffer CopyBuffer (custom1handle,0,0,3, custom1array)... to handle UpperBuffer "OK"; ... {Print ("Copy-custom1array (Upper) error =", GetLastError ());} CopyBuffer (custom1handle,1,0,3, custom2array)... to handle LowerBuffer "ERROR"; ... {Print ("Copy-custom2array (Lower) error =", GetLastError ());} ...
but in the end this error occurs for
CopyBuffer (custom1handle,1,0,3, custom2array)
ERR_INDICATOR_DATA_NOT_FOUND | 4806 | Requested data not found |
the question that comes to mind is:
on the custom indicator when it hooks handles of the first indicator Envelopes (which has two buffers) are both buffers are replicated? because it seems that only one is replicated on the handled custom indicator.
thanks
why nobody reply?
i spent lot of time on forums here mql5.com and others but seems no one has a solution for that!
can anyone answer here?
thanks
why nobody reply?
i spent lot of time on forums here mql5.com and others but seems no one has a solution for that!
can anyone answer here?
thanks
Take the trouble to create a minimal example that you can compile and test. Take the trouble to describe trading conditions: symbol, timeframe, date ...
here minimal code
at line 52
if i declare the copybuffer on 1 ---> CopyBuffer(DEMA2handle,1,0,5,DEMA2array)>0
when i try to use Lower Buffer on handle Envelopes, obtain 4806 with other smoothing indicator
if i declare the copybuffer on 0 ---> CopyBuffer(DEMA2handle,0,0,5,DEMA2array)>0
obtain bad datas because are calculated on default buffer Upper of Envelope
i need two arrays calculated on Upper and Lower Envelopes buffer, it's more clear now?
here minimal code
at line 52
if i declare the copybuffer on 1 ---> CopyBuffer(DEMA2handle,1,0,5,DEMA2array)>0
when i try to use Lower Buffer on handle Envelopes, obtain 4806 with other smoothing indicator
if i declare the copybuffer on 0 ---> CopyBuffer(DEMA2handle,0,0,5,DEMA2array)>0
obtain bad datas because are calculated on default buffer Upper of Envelope
i need two arrays calculated on Upper and Lower Envelopes buffer, it's more clear now?
I will repeat once again: if you want to hear the answer - take the trouble to ask a question. Please provide the minimum MQL5 code. What you showed is a mockery and a torn piece of something incomprehensible.
pablocode :
dear Vladimir Karputov
either there is a misunderstanding or you have problems with understanding,2) I did the minimum code, I attached a zip file with EAs runnable with the code I'am talking about,
why did it disappear from the attachments in the post?
I did what you asked me to do
here I re-link the minimum code in a stackable EA d executable and I also stick it to you in the clear, so okay?
//+------------------------------------------------------------------+ //| EnvSmooth.mq5 | //| Copyright 2020, Pablo Pisto | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, Pablo Code." #property version "1.00" input int ENVperiod = 14; input ENUM_MA_METHOD ENVmethod = MODE_SMA; input ENUM_APPLIED_PRICE ENVPrice1 = PRICE_CLOSE; input double ENVDeviation = 0.100; input int DEMAperiod1 = 30; input ENUM_APPLIED_PRICE DEMAPrice1 = PRICE_CLOSE; input int DEMAperiod2 = 50; input ENUM_APPLIED_PRICE DEMAPrice2 = PRICE_CLOSE; int ENVhandle,DEMA1handle,DEMA2handle; double ENVarrayUpper[],ENVarrayLower[],DEMA1array[],DEMA2array[]; double ENV_Upper = 0, ENV_Lower = 0; double DEMAUpper, DEMALower; int barscc = 0; int OnInit() { ENVhandle = iEnvelopes(NULL,0,ENVperiod,0,ENVmethod,ENVPrice1/*applied price or handle*/,ENVDeviation); DEMA1handle = iCustom(NULL,0,"Examples\\DEMA",DEMAperiod1,DEMAPrice1,0,ENVhandle); DEMA2handle = iCustom(NULL,0,"Examples\\DEMA",DEMAperiod2,DEMAPrice2,0,ENVhandle); ArraySetAsSeries(ENVarrayUpper,true); ArraySetAsSeries(ENVarrayLower,true); ArraySetAsSeries(DEMA1array,true); ArraySetAsSeries(DEMA2array,true); return(INIT_SUCCEEDED); } void OnTick() { barscc++; ENV_Upper=0; ENV_Lower=0; DEMAUpper=0; // smooth on Envelope Upper buffer DEMALower=0; // smooth on Envelope Lower buffer //bufferS: 0 - UPPER_LINE, 1 - LOWER_LINE. // THESE RETURN CORRECT DATA ON ENVELOPE'S HANDLE FOR BOTH BUFFERS if(CopyBuffer(ENVhandle,0,0,5,ENVarrayUpper)>0) ENV_Upper = ENVarrayUpper[1]; else {Print("Copy-ENVarrayUpper error =",GetLastError());} if(CopyBuffer(ENVhandle,1,0,5,ENVarrayLower)>0) ENV_Lower = ENVarrayLower[1]; else {Print("Copy-ENVarrayLower error =",GetLastError());} // THIS RETURN CORRECT DATA ON DEMA'S HANDLE FOR UPPER ENVELOPE BUFFER if(CopyBuffer(DEMA1handle,0,0,5,DEMA1array)>0) DEMAUpper = DEMA1array[1]; else {Print("Copy-DEMA1array(Upper) error =",GetLastError());} // THIS RETURN INCORRECT DATA 4806 ERROR FOR LOWER ENVELOPE BUFFER (that i need) if(CopyBuffer(DEMA2handle,1,0,5,DEMA2array)>0) DEMALower = DEMA2array[1]; else {Print("Copy-DEMA2array(Lower) error =",GetLastError());} Print("Time:",TimeCurrent() ," DEMAonUpper:",DoubleToString(NormalizeDouble(DEMAUpper,6),6) ," DEMAonLower:",DoubleToString(NormalizeDouble(DEMALower,6),6)); if (barscc>5000) TesterStop(); } double OnTester() { return(1); }
note well,
before writing here I looked at all the mql5 documentation (iEnvelopes, iCustom, CopyBuffer, etc ...) and I can't understand why it is not possible to use the Lower buffer of Envelopes with the handle of another indicator attached
- www.mql5.com
I ran your example from a zip archive:
- strategy tester (visual mode) - no errors
- debug in terminal - no errors
OK
but with AMA the error 4806 occur if i use
CopyBuffer(DEMA2handle,1,0,5,DEMA2array)
and if i use
CopyBuffer(DEMA2handle, 0 ,0,5,DEMA2array)
the datas refears on Upper buffer of Envelopes (but i need the data of Lower buffer of Envelopes)
but I did what you asked me and if I tell you that errors or incorrect data come out it means that it is
soI'll ask you the question again, because that's what I need in the end
1) I set a handle on iEnvelopes to get the two buffers Upper and Lower
2) I set a second indicator attached to the Envelopes handle
but I need the final array to be calculated on the Lower buffer values and not the Upper buffer (default)
can you help me? do you know how to do it?
i don't understand why i can't get this answer
please do you know how to set the Copybuffer of an indicator (example AMA or DEMA, etc) attached to the first Envelopes indicator and calculated on its Lower buffer?
I hope I was even clearer
thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone,
Here’s the question:
I get buffers from example indicator multiple buffers like iEnvelopes correctly through numbering in CopyBuffer
but if I hook an indicator with
how can i get handle2’s extracted on two different buffers of handle1-iEnvelopes ???
it seems that handle2 (indicator attached to the Envelopes) has only one buffer and therefore returns all zero values
i need to extract two different buffers from iEnvelopes (Upper and Lower) to manage by two iCustom handles
does anyone have the solution?
I hope I have explained well
thanks in advance for any help