Questions from Beginners MQL4 MT4 MetaTrader 4 - page 3

 
mila.com:

How to do this check in a loop ?

You can do it like this

   for(BarCount=3; BarCount>0; BarCount--)
     {
      if(BufferPointUp[i+BarCount]!= EMPTY_VALUE)
         break;
     }
   if(BarCount==0) BufferPointUp[i]=high[i];
 
Taras Slobodyanik:

you can do this

Thank you.

 
Good afternoon!!! Can you tell me how to make a random selection of a number in a given range? Is there any function for this???
 
bobrush:
Good afternoon!!! Can you tell me how to make a random selection of a number in a given range? Is there any function for this???
The standard one is MathRand(), or just rand().
 

This is bullshit. I've already got the code to this state:

{
   Ticket=OrderSend(NULL,OP_BUY,Lot,Ask,slippage,0,0,NULL,magic,0,Blue);
   if(OrdersTotal()!=0)
   {
    for (int i = 0; i < OrdersTotal(); i++)
    {
     if(OrderSelect(i,SELECT_BY_POS)==true)
     {
      TP=NormalizeDouble(Bid+TakeProfit*Point,Digits);
      bool modify=OrderModify(OrderTicket(),OrderOpenPrice(),TP,0,0);
     }
    }
     return;
   }

Still no TA.

 
Nickolay72:

The TA is still not being put in place.

...when modifying anincorrect stoploss- the log should write "disabled stoploss" error.
 
Nickolay72:

This is bullshit. I've already got the code to this state:

Still no TA.

Why so complicated when there is a ticket?

Ticket=OrderSend(NULL,OP_BUY,Lot,Ask,slippage,0,0,NULL,magic,0,Blue);
//не забываем проверить код ошибки
if(Ticket<0Print("Ой, ошибочка: "_LastError);
TP=NormalizeDouble(Bid+TakeProfit*Point,Digits);

bool modify=OrderModify(Ticket,OrderOpenPrice(),OrderStopLoss(),TP,0);

//не забываем проверить код ошибки

if(!modify) Print("OOPS! Modify error: "_LastError);

 

Hi, advise how to make an EA using 15 minute time frame to check the value every 20 minutes, say at 9-20, 9-40 followed by crossover RSI and if the level is crossed in twenty minutes, check the price value. This is what I need to fix:

if (Hour()==9 && (Minute() == 20) && (RSI<50))
Price2==Bid;
     {
      if (Hour()==9 && (Minute() == 40) && (Bid<Price2))
  
         {
          ticket=OrderSend(Symbol(),OP_SELL, Lts, Bid, SP,0,0, NULL, Magic, 0, Blue);
          return(0);
         }
    
     }    
 
strongflex:

Hi, how can I make my EA check values every 20 minutes using 15 minute timeframe?

...You can check the remainder of the division, if the minutes are divided by 20 without a remainder, then it is the next 20 minutes

if (Minute()%20==0)
 
Taras Slobodyanik:

...you can check the remainder of the division, if the minutes are divided by 20 without a remainder, then it is the next 20 minutes

if (Minute()%20==0)
How do I make the EA remember the price that was at the execution of the condition that at 9-20 RSI crossed the level and 20 minutes later it checks the price. And I need to compare the price 20 minutes ago and now