[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 263

 
Right now, for each bar, it puts one cloze in the array. And if I don't do that, then I have to calculate from which bar to collect data, loop and filter. And this leaves only the latter.
 
gince:

I don't know how many elements an array should have. It could be 40 or 65. In a word, we need a dynamic array.

Use ArraySize to change the size of the array:

int start()
  {
//----
   int start=3;
   int end1=30;
   int end2=90;
   int array[];

     ArrayResize(array, (end1-start) );
     int size1=ArraySize(array);
     ArrayResize(array, (end2-start) );
     int size2=ArraySize(array);

   Comment("start=",start,", end1=",end1,", end2=",end2,", size1=",size1,", size2=",size2);
//----
   return(0);
  }
In the comments it comes out: start=3, end1=30, end2=90, size1=27, size2=87.
 
LeksusMt4:

Good afternoon, Please help, the robot with 0.1 lot multiplies volumes and with 0.01 does not.... What can I change?


And there is a bed! SRC! To insert the code!
 
borilunad:

And there's the bedlam! SRC! To insert code!


I'm not very good at it yet... tell me what to do....

 

Using the SetTLine() function from KimIV https://forum.mql4.com/ru/38949/page6#434255 . The problem is that I need two lines (top and bottom), but it doesn't work for me. Made another function SetTLine1() with other variables, but it still doesn't work. How to do it?

datetime d0=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE));
datetime d1=TimeCurrent()-24*60*60;
while (TimeDayOfWeek(d1)==0 || TimeDayOfWeek(d1)==6) d1-=24*60*60;
d1=StrToTime(TimeToStr(d1, TIME_DATE));
datetime d2=d1-24*60*60;
while (TimeDayOfWeek(d2)==0 || TimeDayOfWeek(d2)==6) d2-=24*60*60;
d2=StrToTime(TimeToStr(d2, TIME_DATE));
int b2=iBarShift(NULL, 0, d2);     // номер бара начала второго дня
int b1=iBarShift(NULL, 0, d1);     // номер бара начала первого дня
int b0=iBarShift(NULL, 0, d0);     // номер бара начала текущего дня
int n2=iLowest(NULL, 0, MODE_LOW, b2-b1-1, b1);
int n1=iLowest(NULL, 0, MODE_LOW, b1-b0-1, b0);
datetime t1=Time[n2];
double   p1=Low[n2];
datetime t2=Time[n1];
double   p2=Low[n1];
SetTLine(Magenta, "", t1, p1, t2, p2, True, STYLE_SOLID, 3);   

datetime di0=StrToTime(TimeToStr(TimeCurrent(), TIME_DATE));
datetime di1=TimeCurrent()-24*60*60;
while (TimeDayOfWeek(di1)==0 || TimeDayOfWeek(di1)==6) di1-=24*60*60;
di1=StrToTime(TimeToStr(di1, TIME_DATE));
datetime di2=di1-24*60*60;
while (TimeDayOfWeek(di2)==0 || TimeDayOfWeek(di2)==6) di2-=24*60*60;
di2=StrToTime(TimeToStr(di2, TIME_DATE));
int bi2=iBarShift(NULL, 0, di2);     // номер бара начала второго дня
int bi1=iBarShift(NULL, 0, di1);     // номер бара начала первого дня
int bi0=iBarShift(NULL, 0, di0);     // номер бара начала текущего дня
int ni2=iHighest(NULL, 0, MODE_HIGH, bi2-bi1-1, bi1);
int ni1=iHighest(NULL, 0, MODE_HIGH, bi1-bi0-1, bi0);
datetime t1i=Time[ni2];
double   p1i=High[ni2];
datetime t2i=Time[ni1];
double   p2i=High[ni1];
SetTLine(..................................................
 

Good afternoon! Please help me with error:ERR_INVALID_FUNCTION_PARAMVALUE - 4051 -Invalid value of function parameter.

I cannot find this invalid parameter.

//--------------------------------------------------------------- 6 --
   Print ("Конец  цикла вычисления торговых критериев --------------------------------------------------------------------");     

      Print("Попытка открыть ордер.");     
      if (Opn_B==true)
        {                                       // критерий откр. Buy
         Print("Попытка открыть ордер. Buy");
         RefreshRates();                        // Обновление данных
         SL=Bid - StopLoss*Point;     // Вычисление SL откр.
         TP=Bid + TakeProfit*Point;   // Вычисление TP откр.         
         Print("Попытка открыть Buy. Ожидание ответа..");
         MyTicket=OrderSend(Symbol(),OP_BUY,Lts,Ask,2,SL,TP);//Открытие Buy counter
         if (MyTicket > 0)                        // Получилось :)
           {
            Print ("  !!!!!!!!    Открыт ордер Buy ",MyTicket);
            return;                             // Выход из start()
           }
           else if (MyTicket < 0)
           {
            Fun_Erorr=GetLastError();
            Alert("GetLastError OP_BUY ", Fun_Erorr);
            }  
         return;                                // Выход из start()
        }
      if (Opn_S==true)              // Открытых орд. нет +
        {                                       // критерий откр. Sell
        Print("Попытка открыть ордер. Sell");
         RefreshRates();                        // Обновление данных
         SL=Ask + StopLoss*Point;     // Вычисление SL откр.
         TP=Ask - TakeProfit*Point;   // Вычисление TP откр.
         Print("Попытка открыть Sell. Ожидание ответа..");
         MyTicket=OrderSend(Symbol(),OP_SELL,Lts,Bid,2,SL,TP);//Открытие Sel ,counter
         if (MyTicket > 0)                        // Получилось :)
           {
            Print ("  !!!!!!!!    Открыт ордер Sell ",MyTicket);
            return;                             // Выход из start()
           }
           else if (MyTicket < 0)
           {
            Fun_Erorr=GetLastError();
            Alert("GetLastError OP_SELL", Fun_Erorr);
            }             
         }
      return(0);
  }
//+------------------------------------------------------------------+

      
 
LeksusMt4:


I don't understand it very well yet... tell me what to do....

SRC is here:


And if the code is very large, as in your case, attach the file:


 
LeksusMt4:


I don't know much yet... tell me what to do....


I answered you in the other thread! And delete your "portmanteau" posts!
 

Now the error is 130, I don't understand why. Who can tell me where I'm going wrong.

   Print ("Конец  цикла вычисления торговых критериев --------------------------------------------------------------------");     

      Print("Попытка открыть ордер.");     
      if (Opn_B==true)
        {                                       // критерий откр. Buy
         Print("Попытка открыть ордер. Buy");
         RefreshRates();                        // Обновление данных
         SL=Bid - StopLoss*Point;     // Вычисление SL откр.
         TP=Bid + TakeProfit*Point;   // Вычисление TP откр.
         Print("SL ",SL," == Bid ",Bid," - StopLoss == ", StopLoss, " * Point ==",Point);
         Print("TP ",TP," == Bid ",Bid," + TakeProfit == ", TakeProfit," * Point ==",Point);         
         Print("Попытка открыть Buy. Ожидание ответа..", "| SL == ",NormalizeDouble(SL,5),"| TP == ",NormalizeDouble(TP,5));
         MyTicket=OrderSend(Symbol(),OP_BUY,0.1,Ask,2,NormalizeDouble(SL,Digits),NormalizeDouble(TP,Digits));//Открытие Buy counter
         if (MyTicket > 0)                        // Получилось :)
           {
            Print ("  !!!!!!!!    Открыт ордер Buy ", MyTicket);
            return;                             // Выход из start()
           }
           else if (MyTicket < 0)
           {
            Fun_Erorr=GetLastError();
            Alert("GetLastError OP_BUY == ", Fun_Erorr);
            }  
         return;                                // Выход из start()
        }
      if (Opn_S==true)              // Открытых орд. нет +
        {                                       // критерий откр. Sell
        Print("Попытка открыть ордер. Sell");
         RefreshRates();                        // Обновление данных
         SL=Ask + StopLoss*Point;     // Вычисление SL откр.
         TP=Ask - TakeProfit*Point;   // Вычисление TP откр.
         Print("SL ",SL," == Bid ",Bid," + StopLoss == ", StopLoss, " * Point ==",Point);
         Print("TP ",TP," == Bid ",Bid," - TakeProfit == ", TakeProfit," * Point ==",Point);
         Print("Попытка открыть Sell. Ожидание ответа..", "| SL == ",NormalizeDouble(SL,Digits),"| TP == ",NormalizeDouble(TP,Digits));
         MyTicket=OrderSend(Symbol(),OP_SELL,0.1,Bid,2,NormalizeDouble(SL,Digits),NormalizeDouble(TP,Digits));//Открытие Sel ,counter
         if (MyTicket > 0)                        // Получилось :)
           {
            Print ("  !!!!!!!!    Открыт ордер Sell ",MyTicket);
            return;                             // Выход из start()
           }
           else if (MyTicket < 0)
           {
            Fun_Erorr=GetLastError();
            Alert("GetLastError OP_SELL == ", Fun_Erorr);
            }             
         }
 
atwas:
On 30 and 31 March 2013 we held a 2-day conference on "All the secrets of winning bets". Everyone was satisfied. On 5 March we will post it on the YouTube channel stavkana1000000. Programme: 5. Study of matches. 6. Identification of sequences. 7. Allocating a reserve - Bank. 8. Calculate at the average KEF bet. Enter stavkana1000000 in any search engine and get the sports (football) betting strategy for free. Or come to the online conferences, which are held every Saturday for free. Andrey Player.

Hey! What casino did you come from?! Perpetual ban to the player!
Reason: