
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
It doesn't work unfortunately.
:), 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.
You haven't done what I said about resources.
Once you fix that it will still fail because you are creating the handle and trying to access the data from OnInit()
Create the handle in OnInit() but use it from OnCalculate() otherwise the data will not be available.
Needing the data in lots of functions doesn't mean you need an include file...
these log entries show the difference between calling the indicator when it is ready and when it is not....
You haven't done what I said about resources.
I did, but it didn't work.
Needing the data in lots of functions doesn't mean you need an include file...
look, I need A higher timeframe date in lower timeframe so i can't work with OnCalculate() parts because bar numbers is different and lots of other data. I use include to get data from HTF then use them in LTF, I have some parameters that changed so after them functions decide which HTF should use for handle and so on... My Indicator A has 14 buffers and I need them and then there is more than 10 indicator to needs the data of A and it's buffers and also there more than 500 functions that use A data to calculate some other staff ... so I can't call A in every other indicator and write all functions in every indicator and...
I did, but it didn't work.
look, I need A higher timeframe date in lower timeframe so i can't work with OnCalculate() parts because bar numbers is different and lots of other data. I use include to get data from HTF then use them in LTF, I have some parameters that changed so after them functions decide which HTF should use for handle and so on... My Indicator A has 14 buffers and I need them and then there is more than 10 indicator to needs the data of A and it's buffers and also there more than 500 functions that use A data to calculate some other staff ... so I can't call A in every other indicator and write all functions in every indicator and...I've shown you with the log output above that it does work if you put the correct references in and call it from the correct place.
You will end up with a lot of issues and an unreliable solution if you try getting data during OnInit() lots of indicators and EAs use MTF data they don't get it from OnInit(). More importantly the fact you are getting the data during OnInit means it will only be accessed on loading the indicator, after that OnInit is not run again.
I've shown you with the log output above that it does work if you put the correct references in and call it from the correct place
would you pls send the code you have made as attached file
would you pls send the code you have made. because "::" always send me error 4802
Below with changes highlighted.
Note you will always be getting the 4802 error because you are running it from OnInit() as already stated. I moved your call to OnCalculate() therefore it will run every tick.
File B
File C
Paul is correct
#resource "\\Indicators… iCustom("::Indicators…
Use the publicly released code - MQL5 programming forum (2017)
Resources - MQL4 Reference
Be aware that using resources is 40x times slower than using CIs directly.
A custom indicator as a resource - MQL4 programming forum (2019)
Also make use there are no spaces in the path.
Getting error 4802 when loading custom indicator that loads another custom indicator with iCustom - Technical Indicators - MQL5 programming forum. (2020)
Also Use of Resources in MQL5 - MQL5 Articles (2011)
Second problem.
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.
They all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
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)
How to start with MQL5 - MetaTrader 5 - General - MQL5 programming forum - Page 7 #61 (2020)
MQL5 for Newbies: Guide to Using Technical Indicators in Expert Advisors - MQL5 Articles (2010)
How to call indicators in MQL5 - MQL5 Articles (2010)
Below with changes highlighted.
Note you will always be getting the 4802 error because you are running it from OnInit() as already stated. I moved your call to OnCalculate() therefore it will run every tick.
File B
File C
That was good and worked fine, now Can you say if I need a data of A.ex5 in OnInit() part of B.ex5 what should I do?!
I have Global parameter that I don't want to calculate it on every ticket I just need to calculate it once in OnInnit(), and it's value effects on OnCalculate() part, so I have to calculate it first in OnInnit() then use it on OnCalculate() partThey all (including iCustom) return a handle (an int). You get that in OnInit. In OnTick/OnCalculate (after the indicator has updated its buffers), you use the handle, shift and count to get the data.
if I need a data of A.ex5 in OnInit() part of B.ex5 what should I do?!
I have Global parameter that I don't want to calculate it on every ticket I just need to calculate it once in OnInnit(), and it's value effects on OnCalculate() part, so I have to calculate it first in OnInnit() then use it on OnCalculate() partThat was good and worked fine, now Can you say if I need a data of A.ex5 in OnInit() part of B.ex5 what should I do?!
I have Global parameter that I don't want to calculate it on every ticket I just need to calculate it once in OnInnit(), and it's value effects on OnCalculate() part, so I have to calculate it first in OnInnit() then use it on OnCalculate() partI'll assume you meant thanks!
Nobody can tell you what to do with your data requests because we do not know your overall design.... and the problem is nor do you, and you are insisting on complicating it with includes, and resources, and data access from OnInit when your knowledge and coding skills are not at that level. It has taken 18 posts to get you to accept what I told you in post 6. and the level of complexity you think you need requires somebody that knows how to design and code.
I'll assume you meant thanks!
Nobody can tell you what to do with your data requests because we do not know your overall design.... and the problem is nor do you, and you are insisting on complicating it with includes, and resources, and data access from OnInit when your knowledge and coding skills are not at that level. It has taken 18 posts to get you to accept what I told you in post 6. and the level of complexity you think you need requires somebody that knows how to design and code.
oh god, I'm really sorry if I bother you, I really don't mean that, I'm so sorry and I'm really thankful to you, I mean it.
look, I have wrote this codes in MT4 and it works fine, but it doesn't same in MT5, I don't know MT5 a lot I want to have least change on my code.
again I don't mean what you felt.