[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 310

 
Parn25:
Can you guys tell me if it's possible to modify a pending order's lot?

Trading orders are modified by the OrderModify(...) function.

The Lots function does not modify lots.

 
mersi:
Two questions.

1. How do I write/enter the first and subsequent variables double abc[10] in the array double ab=a*b?
2. How to write the eleventh variable into an array, removing the first one?

The order in which the variables are written in the array (forward or backward) does not matter. The variables in the array are needed to determine the arithmetic mean.
I have solved the problem.
 
Parn25:
Can you guys tell me if it is possible to change the lot of a pending order?

You cannot change the lot. You can delete this pending order and set a new one with a different volume.

 
artmedia70:

How can you tell if a job is finished and not just a person changing timeframes, for example? Even if by accident...


It is easier then to prohibit jumping between timeframes. According to my observations, such a design prevents from physically switching between timeframes, e.g.

insert in start() or at the beginning of init(). Although no, switching happens with return, but literally in fractions of a second.

void Startimeframe()
{
        int hWnd, wParam;
        switch(Period())
        {
                case PERIOD_M1:  wParam = 33137; break;
                case PERIOD_M5:  wParam = 33138; break;
                case PERIOD_M15: wParam = 33139; break;
                case PERIOD_M30: wParam = 33140; break;
                case PERIOD_H1:  wParam = 33135; break;
                case PERIOD_H4:  wParam = 33136; break;
                case PERIOD_D1:  wParam = 33134; break;
                case PERIOD_W1:  wParam = 33141; break;
                case PERIOD_MN1: wParam = 33334; break;
        }
        hWnd = WindowHandle(Symbol(),Period());
        if(wParam!=33137) PostMessageA(hWnd,WM_COMMAND,33137,0);
}
 

The function closes orders 2 days after they were opened

if (Time[0]-OrderOpenTime() >= 2*1440*60 )  
          {
           OrderClose(OrderTicket(),OrderLots(),NormalizeDouble(Ask,4 ),3,Red);
          }

What would be the right way to exclude weekends from the elapsed time calculation?

I'm thinking of breaking through with iBarShift. Is this the right way to do it?

 
Operr:

The function closes orders 2 days after they were opened

What would be the right way to exclude weekends from the elapsed time calculation?

I'm thinking of breaking through with iBarShift. Is this the right way to do it?

I did so in my EA. However, I counted the total number of trading days minus the weekends, so that I could count the profits correctly.

OrderSelect(0,SELECT_BY_POS,MODE_HISTORY);
   Days=MathRound((TimeCurrent()-OrderOpenTime())/(3600*24));
  //--вычесть выходные дни--------
   for(i=0; i<Days; i++)
    {  
      if(TimeDayOfWeek(CurTime()-i*24*3600)==0 || TimeDayOfWeek(CurTime()-i*24*3600)==6)  Days3++;
    }
   Days-=Days3;
 
Could you please tell me how to reduce the optimisation time, on M1 one parameter is optimised (tester forecast time) 28 hours on a story of 24 hours?
 

Tell me why there's an error when I compile.

//+------------------------------------------------------------------+
//|                                                                  |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright ""
#property link      ""

int Count=0;

//+------------------------------------------------------------------+
//|                                   |
//+------------------------------------------------------------------+
int start()                                     // Спец. ф-ия start()   
{   double Price = Bid;                          // Локальная перемен.   
My_Function();                               // Вызов польз. ф-ии   
Alert("Новый тик ",Count,"   Цена = ",Price);// Сообщение   
return;                                      // Выход из start()   }
//--------------------------------------------------------------------

int My_Function()                               // Описание польз.ф-ии   
{   
Count++;                                     // Счётчик обращений    
}
 
Cheb999:

Tell me why there's an error when I compile.

return;                                      // Выход из start()   }

Closing parenthesis inside a comment

 
Operr:

The function closes orders 2 days after they were opened

What would be the right way to exclude weekends from the elapsed time calculation?

I'm thinking of breaking through with iBarShift. Is this the right way to do it?

Do you have weekend/holiday candles on your chart? They are skipped as it is. No?

Then count how many candles have passed since you opened the position