![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Helou,another day another question.
I have tried to create a Fibo Retracements in my chart, by using the ObjectCreate function. I have found two anchor points for Fibo, both with price and time and use them as a parameters but nothing happend in a chart....
Than I looked in Reference to OBJ_FIBO and there is a really long code, should I really put all the code inside mine or is there easy way? I thought, that MetaTrader will create FIBO, when i use ObjectCretate() with preset parameters and I will change properties of it.....
Helou,another day another question.
I have tried to create a Fibo Retracements in my chart, by using the ObjectCreate function. I have found two anchor points for Fibo, both with price and time and use them as a parameters but nothing happend in a chart....
Than I looked in Reference to OBJ_FIBO and there is a really long code, should I really put all the code inside mine or is there easy way? I thought, that MetaTrader will create FIBO, when i use ObjectCretate() with preset parameters and I will change properties of it.....
No you don't have to put all the code of the documentation in your code, it's better to understand what you are doing![](https://c.mql5.com/3/33/wink__2.gif)
ObjectCreate() is a function you have to check the return value to see if an error occurs, if so then print the error code with GetLastError().
I suggest you to also print the value LowestTime, lowest, HighestTime and highest, as you got them you don't check the return value either (CopyXXXX).
Helou,
i am back from my job, so I continue with MQL and have some follow up questions :)
Thanks for your advice, a went through my code, replenished return operator and try to print everything just to be sure that it is ok step by step.
From CreateObject() I received Error 5040 - Damaged parameter of string type, i have no idea how to solve it..........
and my second question is (sorry it is hard to exlain it in english for me) : I found that OnTick() event is only for Expert advisor, it doesnt work for custom indicators.....
I have started coding with custom indicator, my two MA, and set
property indicator_..... than i put some code in OnTick() but the code doesnt do enything....... I tried to open New empty EA and copy hole my code, but somehow the Meta Trader realize that it is custom indicator, is it because of the proeprty settings filled with indicators??
the OnTick part behave like it is not there....
Helou,
I feel like fool, I declared string FIBO, but did not assign a value, now the problem is solved:)
BUt still the second part of my previous question is valid.
Of course. #property indicatorXXX directive are only for an indicator. You can't use it within an EA.
And OnTick() is not used for indicator. Please check the documentation...
https://www.mql5.com/en/docs/runtime/running
Of course. #property indicatorXXX directive are only for an indicator. You can't use it within an EA.
And OnTick() is not used for indicator. Please check the documentation...
https://www.mql5.com/en/docs/runtime/running
OK now it is a lot clear. Follow up question: is possible to try to put the part of code,rellated to indicators ( 2 EMA) in to include file....
and call the #include file from EA?
OK now it is a lot clear. Follow up question: is possible to try to put the part of code,rellated to indicators ( 2 EMA) in to include file....
and call the #include file from EA?
Probably but it's not the best thing to do in my opinion.
You have to use iCustom() in your EA to get the value of your indicator(s).