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
THANK YOU ALL VERY MUCH!!!
The program code that creates the ZigZagColor indicator on the current chart and removes it after closing the EA looks like this
in block of EA initialization
in block of deinitialization of Expert Advisor
(WARNING for those, who will use this code! This version of the code is an intermediate and is only applicable to the indicator settings Inp_ZZ_Depth = 80; Inp_ZZ_Deviation = 20; Inp_ZZ_Backstep = 0; at other settings, the indicator will not be removed! In order to delete the indicator at other settings in the deinitialization block, you need to specify them instead of 80,20,0).
Now I have to understand how to make it delete the indicator after changing its settings. I have tried the following variant:
It clears the indicator for all settings, but when compiling the EA the editor generates 3 warnings about implicit conversion from number to string:
I suspect it's all about these values: "+Inp_ZZ_Depth+", "+Inp_ZZ_Deviation+","+Inp_ZZ_Backstep+". Well, I have to study the MQL5 programming language further.
Thank you once again for your kind help!
Sincerely, Vladimir.
THANK YOU ALL VERY MUCH!!!
The final code that creates the ZigZagColor indicator on the current chart and removes it after the EA is closed looks like this
in block of EA initialization
in block of deinitialization of EA
(WARNING for those, who will use this code! This version of the code is an intermediate and is only applicable to the indicator settings Inp_ZZ_Depth = 80; Inp_ZZ_Deviation = 20; Inp_ZZ_Backstep = 0; at other settings, the indicator will not be removed! To make the indicator delete at other settings in the deinitialization block, specify them instead of 80,20,0).
Now I want to understand how to make it delete the indicator after changing its settings. I have tried the following variant:
It clears the indicator for all settings, but when compiling the EA the editor generates 3 warnings about implicit conversion from number to string:
I suspect it's all about these values: "+Inp_ZZ_Depth+", "+Inp_ZZ_Deviation+","+Inp_ZZ_Backstep+". Well, I have to study the MQL5 programming language further.
Thank you once again for your kind help!
Sincerely, Vladimir.
The warning on an implicit type conversion. For a strict implementation, the implicit conversion gives a warning.
You should explicitly type. And in MT5 it is always strict execution. In MT4 you can select and not specify in properties #property strict
I am self-taught myself - and I copy from the available codes myself, - The problem is that I don't know how to explain how to sculpt!? - something inside tells me how to sculpt.
----------------------------------
I know what I've moulded, missing there, also a Trawl for the line.
I've added the trawl.
Warning on non-explicit type conversion. for straight (strict) execution a non-explicit conversion gives a warning.
You should explicitly cast the types. And in MT5 it is always strict execution. In MT4 you can select and not specify in the properties #property strict
You're right, Valery! As it stands, everything works as it should. The final version in the block of EA initialization:
in the EA deinitialization block:
Thanks for the tip!
Regards, Vladimir.
Oooh, thank you very much, with so much information you can get so much done...
I'm just about to leave on a business trip, so I'm thinking of going deeper into the materials I've been given, but the coding... I could do it on a sheet of paper too, it would be a good training tool...
Regards, Roman
Good day everyone!
While Roman is away on a business trip and is not participating in this topic, I will continue to ask questions about the MQL5 programming language instead. I found the Maximum Percentage of Equity Risk library in CodeBase at https://www.mql5.com/ru/code/2142. I decided to try to implement opening of Buy and Sell positions in a simple Expert Advisor, but not with a fixed lot, but with the maximum percentage of equity risk.
Here is the source code (I removed all unnecessary things to focus on the main task):
I inserted the code from the specified library into it. I obtained the following code:
But the Expert Advisor continues working by a fixed lot, i.e. the risk is not considered. Please advise what to do to make the risk percentage of the capital gain.
Regards, Vladimir.
Good day to you all!
While Roman is away on a business trip and is not actively participating in this thread, I will continue to ask questions about the MQL5 programming language instead. I found the Maximum Percentage of Equity Risk library in CodeBase at https://www.mql5.com/ru/code/2142. I decided to try to implement opening of Buy and Sell positions in a simple Expert Advisor, but not with a fixed lot, but with the maximum percentage of equity risk.
Here is the source code (I removed all unnecessary things to focus on the main task):
I inserted the code from the specified library into it. I obtained the following code:
But the Expert Advisor continues working by a fixed lot, i.e. the risk is not considered. Please advise what to do to make the risk percentage of the capital gain.
My respect Vladimir.
The way you've written it, that's how it works. You need a line, if Lot==0, then count the risky lot and assign the calculation value to the Lot variable at the end.
In Quaternary this way, through additional variable Lts
Gentlemen, the whole topic is one page of discussion, the rest is code. Isn't it enough to just insert the codes?
How do you help then?
How do you help then?
Only put in what is asked for
This is how it is written and how it works. We need a line if Lot==0 then we count the risky lot and at the end we assign the value of calculation to the Lot variable.
In Quaternary it is like this, through additional variable Lts
Thanks, Valery, I will try it in the evening!
Sincerely, Vladimir.