Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 40
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
Correcting
There is no other way to put it anywhere else, it will be wrong parameters
It should take into account the most recent one.
I'll try to change it.
I tried to use standard OrderModify() but it gets banned if I move a lot of orders simultaneously and constantly
Thanks for the critique.
Declare it WITHOUT ARGUMENT, is it really that hard?
{код функции}
And call an empty one too, and put the elza from there behind curly brackets:
else {когда есть ордера}
And now you have this:
Try it ^_~
It's not working... No trades, no trades...
Does it at least put out the pending orders, no, what are the errors?
...I fixed it.
Finished arguments. terminal hangs tight.
So some sort of loop is flailing around endlessly.
Write #property strict at the beginning of the code and fix it, lots of warnings.
It is quite possible division by 0 in the last function.
After else only the first line will be executed, the braces block is left orphaned.
In general, write out the logic on paper with words first, otherwise it's wobbly.
It is supposed to execute a command with a floating decimal point depending on decimals on the chart
NormalizeDouble(Ask+TakeProfit*Point(),Digits)
and how did you see that some lines were not executed?
It is supposed to execute a command with a floating decimal point depending on decimals on the chart
NormalizeDouble(Ask+TakeProfit*Point(),Digits)
How do you know that some lines are not executed?
Yep. I have big problems with logic. And what would be left of the result if it is written into an integer variable? What's the point of this code?
lastlot=NormalizeDouble(lastlot*Martin,3);
tp=NormalizeDouble(avg_price+TakeProfit*Point(),Digits);
Here, is it so hard to understand that part of the code is orphan and will be executed regardless of the condition?
otype=FindLastOType(); //код, исполняющийся для else
{
код-сирота
}
Yeah, that's a big problem with logic. And what's left of the result if it's written to an integer variable? What is the point of this code?
lastlot=NormalizeDouble(lastlot*Martin,3);
tp=NormalizeDouble(avg_price+TakeProfit*Point(),Digits);
Is it so hard to understand that part of the code is an orphan and won't be executed?
otype=FindLastOType(); //код, исполняющийся для else
{
код, который никуда не идёт, сирота
}
Stop
if there are orders
The order type is
{
then operations are executed for that order type
}
not?
Can't figure out where zero divide comes fromStop
if there are orders
is the order type
{
then operations are carried out for this order type
}
no?
Yes, you're right, it's just that the code is written in such a style that the previous speaker misinterpreted it.
Added:zero div ide is a division by zero, and it tells you in the log what line
Stop
if there are orders
is the order type
{
then operations are carried out for this order type
}
no?
Corrected above. What comes after else is executed depending on the condition. Block of curly brackets is separate, so it has nothing to do with else.
That's where
{
double avg_price; //+------------средняя цена
price=0;//+------------цена
bool z;//+------------выход в переменную
double orderlots=0; //+------------лоты
avg_price=NormalizeDouble(price/orderlots,Digits);//+------------то средняя ценаравна цена деленная на лот