Here is my modify pending order function. When modifying, I set a new price and a new stoploss. The function works partially, but for some reason the tester is getting errors 1.
Is my function written correctly?
void MovingPendingOrders(/*int ticket, double newPrice*/)
{
double priceS = NormalizeDouble((Low[1] - i_thresholdFromInput*pt),Digits); // Новая цена открытия для OP_SELLSTOPdouble priceB = NormalizeDouble((High[1] + i_thresholdFromBasedSL*pt),Digits); // Новая цена открытия для OP_BUYSTOPbool b_mod, s_mod;
int total = OrdersTotal() - 1;
int s_ticket, b_ticket;
for(int i=total; i>=0; i--)
{
if(!OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) continue;
if(OrderMagicNumber() != i_myMagic) continue;
{
if(OrderType() == OP_BUYSTOP)
{
b_ticket = OrderTicket();
b_mod = true;
}
if(OrderType() == OP_SELLSTOP)
{
s_ticket = OrderTicket();
s_mod = true;
}
}
}
if(IsTradeAllowed())
{
if((b_mod) && (priceB > Ask)) OrderModify(b_ticket,priceB,priceS,0,0,Brown);
if((s_mod) && (priceS < Bid)) OrderModify(s_ticket,priceS,priceB,0,0,Brown);
}
Print("MovingPendingOrders переоткрыл ордер по новой цене");
}
Here is my modify pending order function. When modifying, I set a new price and a new stoploss. The function works partially, but for some reason the tester is getting errors 1.
Is my function written correctly?
...and on every tick you modify over and over again. ?!
silatyt: ...and on every tick you modify over and over again. ?!
I didn't know where to put it, I messed up the Expert Advisor's logic by inexperience. To check the function, I put it in the start... Yes, it was on every tick, that's why the error. Then, after the function defining a new bar, I put it in and corrected the code asTheXpert told me and everything went as it should.
Good afternoon. Could you please tell me what a piece of EA code should look like, which is responsible for the following:
1. Goes through the parameters one by one (in a given range, eg from 10 to 20) of the indicator, on which the EA is based, until the condition to open the trade is not met.
2. If the condition after the search is not fulfilled - wait 5 minutes.
Good afternoon. Do you know if it's possible to send code execution from line 35 to line 18 (lines for example) with the standard mql4 tools. A kind of jumping in the code.
tpg_k156: Good afternoon. Do you know if it's possible to send code execution from line 35 to line 18 with the standard mql4 tools (lines for example). A kind of jumping in the code.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Here is my modify pending order function. When modifying, I set a new price and a new stoploss. The function works partially, but for some reason the tester is getting errors 1.
Is my function written correctly?
Is my function written correctly?
Here is my modify pending order function. When modifying, I set a new price and a new stoploss. The function works partially, but for some reason the tester is getting errors 1.
Is my function written correctly?
Please advise how to make an EA output a comment on top of a frame that covers the chart to make it easier to read.
I do not know how to do it now:
It should be like this:
...and on every tick you modify over and over again. ?!
I didn't know where to put it, I messed up the Expert Advisor's logic by inexperience. To check the function, I put it in the start... Yes, it was on every tick, that's why the error. Then, after the function defining a new bar, I put it in and corrected the code asTheXpert told me and everything went as it should.
Good afternoon. Could you please tell me what a piece of EA code should look like, which is responsible for the following:
1. Goes through the parameters one by one (in a given range, eg from 10 to 20) of the indicator, on which the EA is based, until the condition to open the trade is not met.
2. If the condition after the search is not fulfilled - wait 5 minutes.
Good afternoon. Do you know if it's possible to send code execution from line 35 to line 18 with the standard mql4 tools (lines for example). A kind of jumping in the code.
Operators switch / if - else
and functions
switch / if - else operators
and functions
so it is possible to force the same function body to execute itself again? such as
so it is possible to force the same function body to execute itself again? like
Yes. It's called recursion.