Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 822

 

If you want num to be equal to zero, you can use while.


num = 1;
while (num != 0){
 if(Close[z+1]<Close[z+3]) {num=num+1;
         
                           } else  {num=0;}
 }
 
OK, no more needed.... Sort of got it right.....
 
fedor9932:
Thanks, I'll have a look.
 

how to place a market order?

void OnStart()
{
//---

// Opening BUY
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point);
return;

}


It generates a warning returning value of 'OrderSend' should be checked

 
sirurik:

How do I place a market order?


A return value of 'OrderSend' should be checked

Well, you have to check it, at least like this:

void OnStart()
  {
//---

                                          // Открытие BUY
      if(OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-15*Point,Bid+15*Point)<1)
      Print("Попытка торговать завершилась ошибкой №", GetLastError());
   }
 

I don't know if this is right or wrong, but the script works.

int OnStart()// Instead of Void int
{
//---

// Open BUY
int check =OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-150*Point,Bid+150*Point); //add variable int check= ; changed stop loss and teic from 15 to 150 because broker is five-digit
return(check);//return added check

}

I can't find anywhere what was really changed in the 600+ build. I cannot find information on how to adapt it to the new Metaeditor, neither. Do you have any information concerning the adaptation of the old MQL4 to the new one? Please share)

 
sirurik:

I don't know if this is right or wrong, but the script works.


I can't find anywhere what was really changed in the 600+ build. I also don't know how to adapt it to the new Metaeditor. If you have any information concerning the adaptation of the old MQL4 to the new one, please share)

This is also possible for the script.

They really added structures, classes and other OOP. Also special functions of separate types for different types of programs, earlier it was int start() for all types, now void (may be int) OnStart() - for scripts, void OnTick() - for Expert Advisors, int OnCalculate() - for indicators. There are also many other small things in the syntax, that can be used or not, and you can use the old way of writing.

Most of the well-written code in the new builds do not need to be adapted. In illiterate ones, most often it is necessary to correct errors of array overruns, especially in indicators.

 
Can you tell me if MT4 supports dual monitor mode?
 
Guys, tell me why 4202 gives out (The object doesn't exist). It's right that it doesn't exist I need to create it, but it (doesn't exist)! What can be done with it? Or I screwed up somewhere else?
//+------------------------------------------------------------------+
 bool ArrowDownCreate()
 {
       if(!ObjectCreate(ChartID(),"Продажа",OBJ_ARROW_DOWN,0,SignalBarsTime,Hi2))
          {
            Print(__FUNCTION__,
                ": не удалось создать знак \"Стрелка вниз\"! Код ошибки = ",GetLastError());
              return(false);
          }
        ObjectSet("Продажа",OBJPROP_ANCHOR,ANCHOR_BOTTOM);
        ObjectSet("Продажа",OBJPROP_COLOR,Red);
        ObjectSet("Продажа",OBJPROP_WIDTH,5);

     return(true);
 }
//+------------------------------------------------------------------+
 bool ArrowUpCreate()
 {
       if(!ObjectCreate(ChartID(),"Покупка",OBJ_ARROW_UP,0,SignalBarsTime,Lo2))
          {
            Print(__FUNCTION__,
                ": не удалось создать знак \"Стрелка вверх\"! Код ошибки = ",GetLastError());
              return(false);
          }
        ObjectSet("Покупка",OBJPROP_ANCHOR,ANCHOR_TOP);

        ObjectSet("Покупка",OBJPROP_COLOR,Green);

        ObjectSet("Покупка",OBJPROP_WIDTH,5);

     return(true);
}
//+------------------------------------------------------------------+
 

Veterros:
Ребят подскажите, почему 4202 выдаёт (Объект не существует). Правильно что не существует его создать надо, а он мне (не существует)! Чего можно с ним сделать? Или я где-то опять накосячил?

else add after the closing curly bracket, or inside this bracket move the object modification operators.

Reason: