- Here is a quick introduction to MQL5: https://www.mql5.com/de/articles/496
- To get custom indicator values in MQL5 you have to use iCustom() - there is an example in the reference (in the editor place the above iCustom and press F1!)
- To find and correct problems use this:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
- www.mql5.com
- Here is a quick introduction to MQL5: https://www.mql5.com/de/articles/496
- To get custom indicator values in MQL5 you have to use iCustom() - there is an example in the reference (in the editor place the above iCustom and press F1!)
- To find and correct problems use this:
Code debugging: https://www.metatrader5.com/en/metaeditor/help/development/debug
Error Handling and Logging in MQL5: https://www.mql5.com/en/articles/2041
Tracing, Debugging and Structural Analysis of Source Code, scroll down to: "Launching and Debuggin": https://www.mql5.com/en/articles/272
thanks for your consideration,
of Corse I have read all above links, but it doesn't solve anything. it's a MQL5 bug and I need something else to achieve it.
thanks for your consideration,
of Corse I have read all above links, but it doesn't solve anything. it's a MQL5 bug and I need something else to achieve it.
It will be your code, so if you want help you will need to post your code, along with the error description. use the code button </> or Alt+S to post code
It will be your code, so if you want help you will need to post your code, along with the error description. use the code button </> or Alt+S to post code
My Indicator A's name is "A0_Legs_0" and it is in MQL5\Indicators and also it works fine, I reference it by bellow line in to my Include file (C.mqh)
#resource "\\Indicators\\A0_Legs_0.ex5"
the bellow function is in my Include file (C.mqh) refers to iCustom
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double Legs(long A_ChID, string A_MySymbol, int t, //t:timeframe, int d, //d:buffers number in my indicator A (my indicator A has more than 1 buffer and I need several buffer) int i) //i:Candle number { int Handle = iCustom(A_MySymbol, MyTimeFramesMQL4(t), "A0_Legs_0.ex5"); int err0 = GetLastError(); double p = 0; double MyLegsIndicator[]; int copy = 0; copy = CopyBuffer(Handle, d, i, 1, MyLegsIndicator); //iBars(A_MySymbol, MyTimeFramesMQL4(t)) - 1 int err = GetLastError(); if(copy == -1)// && err == 4806) { if(err == 4806) { //--- wait till the data is uploaded for(int j = 0; j < 10000; ++j) if(BarsCalculated(Handle) > 0) break; copy = CopyBuffer(Handle, d, i, 1, MyLegsIndicator); err = GetLastError(); } } //--- check coying result if(copy == -1) { Print("Error when trying to get --A0_Legs_0-- values, last error is ", err0, "_", err, " bars ", i, " buffurs ", d, " TF ", MyTimeFrameNames[t]); return(0); } p = MyLegsIndicator[0]; return(p);
then I use bellow code to get my Indicator buffers data every where else, in the include file(C.mqh) functions or in another indicator(B) that has #include <C.mqh>
Legs(A_ChID, A_MySymbol, t, 3, i)
I always receive copy = -1 then error code 4806
My Indicator A's name is "A0_Legs_0" and it is in MQL5\Indicators and I reference it by bellow line in to my Include file (C.mqh)
the bellow function is in my Include file (C.mqh) refers to iCustom
then I use bellow code to get my Indicator buffers data every where else, in the include file(C.mqh) functions or in another indicator(B) that has #include <C.mqh>
As per the documentation you need to reference the resource correctly...
int Handle = iCustom(A_MySymbol, MyTimeFramesMQL4(t), "::Indicators\\A0_Legs_0");
no idea what this is suppose to be, it is not how you access indicator data, read about copybuffer
Legs(A_ChID, A_MySymbol, t, 3, i)
- www.mql5.com
int Handle = iCustom(A_MySymbol, MyTimeFramesMQL4(t), "::Indicators\\A0_Legs_0.ex5");
I have tried it and gets error code 4802
this is my simple way to get data.
is there any way to you to write a simple custom indicator(A.ex5) and then call it in a simple Include file (C.mqh) and use it's data in one of the functions in C.mqh ? would you pls do it and send me the code?
I have tried it and gets error code 4802
this is my simple way to get data.
is there any way to you to write a simple custom indicator(A.ex5) and then call it in a simple Include file (C.mqh) and use it's data in one of the functions in C.mqh ? would you pls do it and send me the code?
my bad, I left the .ex5 in, you need to remove it when referencing the resource.
int Handle = iCustom(A_MySymbol, MyTimeFramesMQL4(t), "::Indicators\\A0_Legs_0");
your simple way to get data is meaningless as you have presented it.
given that you can barely code MQL5 why are you trying to complicate it so much, you shouldn't need to use include files at your stage of knowledge.
life would be easier if you posted the whole code...It doesn't work unfortunately.
your simple way to get data is meaningless as you have presented it.
given that you can barely code MQL5 why are you trying to complicate it so much, you shouldn't need to use include files at your stage of knowledge.
life would be easier if you posted the whole code...:), I know but, I need the data in a lots of functions so I can't write iCustom and copybuffer every time.
I have attached 3 files, 2 indicators and one C.mqh
put B.mq5 in D1 chart, it should print the data of A.mq5 in candle 10 MN (Print(Function0(ChartID(), ChartSymbol(), 7, 0, 10))) but it refers 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
Hi
I have an indicator(A.ex5) and I want to reference it in an include file (C.mqh) or another indicator (B.ex5) But I always receive error code 4806 and 4802
As I'm new in MQL5, at first I want to know the procedure of referencing an indicator (to be sure I have done it correct) then what's the solution, as I have searched it's a kind of MQL5 bugs.