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

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
Hello, please help me with the error that occurs in the tester when I try to modify an order (transfer to Breakeven): I put the OrderOpenPrice() function instead of SL, but the tester shows error1 (according to the documentation it means that there is an attempt to passunchanged values as parameters to the function). I attach the code! Thank you in advance!
void DeleteOrderFunction2() //function that deletes the second order and sets the second order to Breakeven on a certain evening
{
bool flag = false;
if (FlagDeleteSecondOrder2 == true)
{
if(DayOfWeek() == DAYOFWEEK && //if a weekday is selected
Hour() == 22 //if evening
)
{
if(BuyCount() == 1 && if(there is an open Buy order
SellStopCount() == 1 //and there is a sell pending order
)
{
for( int i = 0; i < OrdersTotal(); i++) //create orders
{
OrderSelectX(i, SELECT_BY_POS, MODE_TRADES;)
switch(OrderType())
{
case OP_BUY: if(OrderProfit() > 0 &&
Bid > OrderOpenPrice()
)
{
OrderModifyX(OrderTicket(),OrderOpenPrice(),OrderTakeProfit(),0,Arrow_Color);
flag =true;
}
break;
case OP_SELLSTOP: if(flag==true)
{
OrderDeleteX(OrderTicket(), Arrow_Color);
}
break;
}
}
}
if(SellCount() == 1 && // if there is an open Sell order
BuyStopCount() == 1 //and there is a Buy pending order
)
{ Print("IS!!!!");
for( int i = 0; i < OrdersTotal(); i++) //create orders
{
OrderSelectX(i, SELECT_BY_POS, MODE_TRADES;)
switch(OrderType())
{
case OP_SELL: if (OrderProfit() > 0 &&
Ask < OrderOpenPrice()
)
{
OrderModifyX(OrderTicket(), OrderOpenPrice(),OrderTakeProfit(),0, Arrow_Color);
flag = true;Print("flag =", flag);
}
break;
case OP_BUYSTOP: if(flag == true)
{
Print("flag =", flag);
OrderDeleteX(OrderTicket(), Arrow_Color);
}
break;
}
}
}
}
}
}
Help me convert the indicator into a script!
If iHigh(NULL,PERIOD_H1,[i+2]) and iLow(NULL,PERIOD_H1,[i+2]) are written instead ofHigh [i+2] andLow[i+1], then you can control the timeframe?
If Hai matched SELL, if Loh BUY!
Help me convert the indicator into a script!
If iHigh(NULL,PERIOD_H1,[i+2]) and iLow(NULL,PERIOD_H1,[i+2]) are written instead ofHigh [i+2] andLow[i+1], then you can control the timeframe?
If Hai matched SELL, if Loh BUY!
three coincidences will have to wait a long time
three hits will have to wait a long time.
I'm not a scalper, I'll wait. We can normalise on the 4 digits.
in mql5 we have open positions, I find all trades in this position and determine whether they were opened by market or pending orders
in mql4, how can i find out if an open position was opened by market or pending orders and its tickers change when a pending order triggers?
Yes and the result is weak ...
in mql5 we have open positions, I find all trades in this position and determine whether they were opened by market or pending orders
in mql4, how can i find out if the open orders were opened by market or pending orders and their tickers change when a pending order triggers?
give them different magiks
give them different magiks
Orders are opened by a user, I need to define their type when they are opened
The question is what will "load more": at each defined InChartEvent redefine the indicator handle or define all possible handles as an array beforehand in OnInit?