Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 357

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
Try to write Date, Time, Bid and results of your calculations in file for each tick. Then upload it to Excel and check it. It hardly makes sense to reconcile every dozen lines of the program!
But look, you have return in every branch of the conditional operator, i.e. it is always executed. So we take it out of the conditional operator:
Bid[1] - is it so?
Thank you. I will try it now. I understood the gist of your code and it is already a great achievement for me :) I also saw my shortcomings.
What is SRC button?
Try to write Date, Time, Bid and results of your calculations to the file for each tick. Then upload it to Excel and check it. It hardly makes sense to reconcile every dozen lines of the program!
But look, you have return in every branch of the conditional operator, i.e. it is always executed. So we take it out of the conditional operator's scope:
Bid[1] - is it like that?
I have inserted the code in the "constructor" of the custom indicator. I have compiled it. The compiler generated 1 warning: Two OnCalculate are defined. OHLC version will be used (I don't understand what it means).
Got compiled product. Attach it to the chart. The separate window for the chart is opened but it does not show any info about the histogram, despite the ticks.
What is wrong? Please, advise?
I inserted the code into the "constructor" of the custom indicator. Compiled it. The compiler gave me 1 warning: two OnCalculate are defined. OHLC version will be used (I don't know what it means).
Got compiled product. Attach it to the chart. The separate window for the chart is opened but it does not show any info about the histogram, despite the ticks.
What is wrong? Can you advise?
When you paste the code here, use button of message editor SRC - at the top of message field there are many useful things in the message formatting panel.
It's not hard to raise your eyes just above the text you're typing, is it? And it's much more pleasant for people to look at normal code instead of the swag, isn't it?
I have inserted your code for you in your post correctly (SRC)
When you paste the code in here, use the SRC post editor button - there are lots of useful features in the post formatting panel at the top of the post box.
It's not hard to raise your eyes just above the text you're typing, is it? And it's much more pleasant for people to look at the normal code instead of the swag, isn't it?
I put your code in your message for you correctly (SRC)
Yeah. Thanks. I didn't know that.
Issued 1 warning to compiler: two OnCalculate are defined. OHLC version will be used (not sure what this means).
Got compiled product. Attach it to the chart. The separate window for the chart is opened but it does not show any info about the histogram, despite the ticks.
What is wrong? Please, advise?
The function was called Start before, now it is called OnTick in Expert Advisor and OnCalculate in indicator. The compiler warns: you have the same function twice under different names. Move the contents of Start to OnCalculate and delete Start. You would also need to describe in your program, what and how it should be displayed. First decide for yourself - what image must be there? It is better to start studying the MQL language by writing scripts. An Expert Advisor is more complicated, an indicator is even more complicated
The function used to be called Start, now it is called OnTick in the EA and OnCalculate in the indicator. The compiler warns: you have the same function twice under different names. Move the contents of Start to OnCalculate and delete Start. You would also need to describe in your program, what and how it should be displayed. First decide for yourself - what image must be there? It is better to start studying the MQL language by writing scripts. The Expert Advisor is more difficult, the indicator is even more difficult.
I cannot insert the content of Start in OnCalculate and get a lot of errors
The indicator only displays information from the start. The Data window (Ctrl-D) shows data of the candlestick, to which the cursor is pointing
:)
And how do you formulate the created situation with function names?
start - obsolete name. OnTick() is the actual name of the tick handling function.
Anyway, it doesn't make any difference how you define it, just the word "trendy" made me smile.
start - obsolete name. OnTick() is the actual name of the tick handling function.
Anyway, it doesn't matter how you define it, it's just the word "trendy" that makes you smile.