Questions from Beginners MQL5 MT5 MetaTrader 5 - page 852

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
Doesn't open a trade, where's the fault?
Doesn't open the trade, where's the bug?
Bug number 1: On each tick you create a NEW indicator HANDL
Shoal number 2: (probably) the Lot variable has an incorrect volume.
Flaw number 3: (probably) order filling type for CTrade class is not filled.
In general, what's in the terminal's (or tester's) log?
the amount multiplied by the loss in currency from 1 SL
And if the loss is 1, in BO for example.
I put the values into the formula, not even close to the same result.
What is wrong?
Gap number 1: On each tick you create a NEW indicator HANDL
Shoal number 2: (probably) the Lot variable has an incorrect volume.
Flaw number 3: (probably) order filling type for CTrade class is not filled.
Anyway, what's in the terminal's (or tester's) log?
This code yes was in onitics
Moved it to onytics. I've just read the articles here - and I've understood that there is no difference for work, but it's better in onitiket. But in terms of clarity for myself, I was more convenient to do everything in 1 block, I am purely for myself while solving problems that I set myself (learning.)
The problem was with the lot - I had to put not a variable lot - and the function returnlot (because it was a function for calculating the lot).
Now I found a mistake in lot function - lot is calculated with a lot of decimal places and as a result the order cannot be opened. We need to reduce unnecessary characters and leave only 2.
NormalizeDouble and DoubleToStr so far can not work - writes that the function can not be placed in the function, and below when I put their work with the function writes error - which I can not fix.
This code was in onitics.
Moved it to ontic. I just read the articles here - and from them I understood that there is no difference for work, but it's better in ontiket. But in terms of clarity for myself, I was more convenient to do everything in 1 block, I am purely for myself while solving problems that I set myself (learning.)
The problem was with the lot - it was not necessary to set a variable lot - and the function returnlot (because there was a function for calculating the lot).
Now I found a mistake in lot function - lot is calculated with a lot of decimal places and as a result the order cannot be opened. We need to reduce unnecessary characters and leave only 2.
When I paste the function NormalizeDouble and DoubleToStr I cannot do it yet - it says that the function cannot be put into a function, and when I paste them below the function writes errors that I cannot correct.
In MQL5 you need to create an indicator handle ONLY once and ONLY in OnInit. It is an axiom. You can not create an indicator handle on each tick in OnTick - it is incorrect.
The correct normalization of the lot is in the trade class CSymbolInfo::NormalizePrice
In MQL5 you must create an indicator handle ONLY once and ONLY in OnInit. It is an axiom. You can not create an indicator handle on each tick in OnTick - this is RIGHT.
The correct normalization of the lot is in the trade class CSymbolInfo::NormalizePrice
Wrong, I don't argue with that. BUT!!! What will change if we create it on every tick??? Not even the value will change.
Wrong, there's no arguing with that. BUT!!! What's going to change if you create on every tick??? Not even the value will change.
What's the point? Just a lot of extra work for the script, that's all.
Wrong, no argument with that. BUT!!! What's going to change if you create on every tick??? Not even the value will change.
In a recent article I've shown that MQL5 effectively combats the vestiges of coding in MQL4 style - creation of handles on every tick: the memory is not wasted, but the operation speed is decreased at least. But I repeat: creating indicators in MQL5 in MQL4 style is not the right method. If you switch to MQL5, it means that the programming style must be rebuilt.
What's the point? It's just extra work for the script, that's all.
Of course there is no point. It was such a hidden question drubashke: Why resemble the neurotic, which are enough here as it is, and include Caps Lock?
That is, the result is the same, but of course the execution is meaningless and much busier, as I understand from what has been written.
I wish they had thought to write about it in the article, but in general it is clear that there is no reason to do the same thing several times.
But I had the goal to write to understand and work itself, not to optimize-that's after I counted.