[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 164

 
evgenio писал(а) >>

It's not working.

Sorry. Script code. It's working. Checked it out.

#property show_confirm

int start() {
   Print("Start");
   double as[5];
   for (int i=0; i<5; i++) {
      as[ i]=Low[ i];
      Print( i," ", as[ i]);
   }
   Print("Stop");
   return(0);
}
 

Please tell me how to spell the operator that pauses in milliseconds. I keep forgetting. I remember once forgetting it and then looking for it for a long time. Again, I don't remember where I looked for it. I will probably spend a long time looking for it again.

Please tell me how to spell it - I've forgotten again.

 
FOReignEXchange писал(а) >>

Please tell me how to spell the operator that pauses in milliseconds. I keep forgetting. I remember once forgetting it and then looking for it for a long time. Again, I don't remember where I looked for it. I will probably spend a long time looking for it again.

Please, tell me how to spell it - I've forgotten it again.

Sleep()

 
Vinin >> :

Sleep()

Oh, right, thank you very much.

 
Good afternoon. Could you please tell me how to check if there is a position opened on the current bar and if there is, to prohibit opening new ones. Starting from the next bar the restriction is removed. Sleep() does not work.
 
Alex5757000 >> :
Hello. Can you please tell me how to check if there is a position opened on the current bar and if there is, then prohibit opening new ones. From the next bar this restriction is removed. Sleep() does not work.

When opening a position, remember the time

t=TimeCurrent()


And in the deal opening condition put a condition


if (iBarShift(NULL,0, t)>0)

This should work, if I'm not mistaken.

 
Alex5757000 >> :
Good afternoon. Can you please tell me how to check if there is a position opened on the current bar and if there is, then prohibit opening new ones. Starting from the next bar the restriction is removed. Sleep() does not work.
bool ЗапретитьТорговлю = false;
for(int k = 0; k < OrdersTotal(); k++ )
{
   OrderSelect( k, SELECT_BY_POS, MODE_TRADES); // Проверяем каждый ордер. 
                                             // Если он открыт после времени открытия текущего бара - запрещаем торговлю.
   if(OrderOpenTime()>Time[0])
   {
      ЗапретитьТорговлю = true;
      break;
   }
}
 
FOReignEXchange and mql-experts, thank you!
 

Something curious:(

The indicator is in the process of calculating profit and loss. I want to put the results in comments (output on the screen):


      int    TotalProfit_pips    = TotalProfit;
      int    TotalProfit_count   = ( Buy_Profits_Count+ Sell_Profits_Count)-( Buy_Losses_Count + Sell_Losses_Count);
      int    TotalTrades_count   = ( Buy_Profits_Count+ Sell_Profits_Count)+( Buy_Losses_Count + Sell_Losses_Count);
      int    Total_Profits_Count = Buy_Profits_Count+ Sell_Profits_Count;
      int    Total_Losses_Count  = Buy_Losses_Count + Sell_Losses_Count;
//      double WinningRatio        = Total_Profits_Count / TotalTrades_count;

Without last line (commented out) everything works as it should.

But as soon as you leave it uncommented, all you see are just the candlesticks and nothing more. Rebooting MT didn't help.

What can it be?

 
chief2000 >> :

Something curious:(

The indicator is in the process of calculating profit and loss. I want to put the results in comments (output on the screen):


Without last line (commented out) everything works as it should.

But as soon as you leave it uncommented, all you see are just the candlesticks and nothing more. Rebooting MT didn't help.

What can it be?



All variables of int type are integers. When dividing an integer by an integer, the answer is also an integer. And if the first number is less than the second, the answer will always be 0. This may be the problem.

If you have a possibility - change all the types to double.

Reason: