- ZeroCafeine: I'm wondering how to use this function, how can I retrieve the function's return or a concrete example of its use?
What function?
How To Ask Questions The Smart Way. (2004)
Be precise and informative about your problem -
int var02 = IndicatorSetDouble(INDICATOR_MINIMUM,0); int var03 = IndicatorSetDouble(INDICATOR_MAXIMUM,100); int var04 = IndicatorSetString(INDICATOR_SHORTNAME,"Prix Cloture"); int var05 = PlotIndexSetString(0,PLOT_LABEL,"Prix Cloture");
Perhaps you should read the manual. None of those calls return an int.
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.
tks for your answers, I red the manuel and I know all they are boolen fonction, but I don't find how to use IF condition to check a boolen value, so I used the int to check if 0 or 1, if you have a good link pls 🙂 ?
Thanks for changing the subject to the right section I'm a beginner I can still make mistakes, however my question is not about an indicator but as the title says how to use the Return function with the parameter INIT_FAILED
You are using functions like SetIndexBuffer() and IndicatorSetDouble() which are only valid for Custom Indicators and not EAs, so your question is assumed to be related to technical indicators.
If however, you are coding an EA, then those functions cannot be used. You should clarify if you are coding an Indicator or an EA, then.
Please note that OnInit() function is an event handler called by the terminal. You do not have access to it's return value, nor should you call the function directly.
tks you, So I'm too far with my question, and sorry for this stupid question, but it's a question, So I can learn about this 2 fonction it's not possible with EA, Can I understand from your answers : it's not possible to use my own indicators in EA (I don't have any specific indicators, it's just for the question) ?
The question was just about the Return() function, it's true that the code I inserted above comes from an indicator but that wasn't the point of my question (indicator or EA), thanks again for the clarification.
I think I'm going to go and do some research on the different event managers and understand a bit how they work and how they interact with each other,
I'll have a look at the official documentation but if anyone can share a good article or good tips on the different events it would be most welcome.
Best Reguards,
ZeroCafeine 😊
- www.mql5.com
To retrieve data from Custom Indicators in an Expert Advisor (EA), you need to use the iCustom() function together with CopyBuffer().
EDIT: Also have a look at the functions for internal indicators — Documentation on MQL5: Technical Indicators
- www.mql5.com
- When in doubt, think!
bool var01 = SetIndexBuffer(0,IndicateurBuffer,INDICATOR_DATA); bool var02 = IndicatorSetDouble(INDICATOR_MINIMUM,0); bool var03 = IndicatorSetDouble(INDICATOR_MAXIMUM,100); bool var04 = IndicatorSetString(INDICATOR_SHORTNAME,"Prix Cloture"); bool var05 = PlotIndexSetString(0,PLOT_LABEL,"Prix Cloture"); if(!var01 || !var02 || !var03 || !var04 || !var05) { Print ("INIT_FAILED"); return(INIT_FAILED); } Print ("INIT_SUCCEEDED"); return(INIT_SUCCEEDED);
-
You should be able to read your code out loud and have it make sense. You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool). Code becomes self documenting when you use meaningful variable names, like bool isLongEnabled where as Long_Entry sounds like a trigger price or a ticket number and “if long entry” is an incomplete sentence.
- When in doubt, think!
-
You should be able to read your code out loud and have it make sense. You would never write if( (2+2 == 4) == true) would you? if(2+2 == 4) is sufficient. So don't write if(bool == true), just use if(bool) or if(!bool). Code becomes self documenting when you use meaningful variable names, like bool isLongEnabled where as Long_Entry sounds like a trigger price or a ticket number and “if long entry” is an incomplete sentence.
tks you for your help, As for the example you gave me below " if( (2+2 == 4) == true)", I'm still not up to the level of making such rubbish, but you're right to discuss it.
Thank you very much for your answer with the coded example, it seems so logical when you read it and think why didn't I think of that, I think I have the answer: it's because I'm old 😅 and I was tired 🤣 and I'm new to this language 😊.
@William Roeder
I think my mistake comes from this text, it must be my subconscious making shortcuts 😊
- 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
I'm a beginner and I'm wondering how to use this function, how can I retrieve the function's return or a concrete example of its use?
Best Reguards
ZeroCafeine