[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 331

 
sergeev:

for programmers.

they can switch currencies, timeframes or left bars so programmatically.


Thank you, where can I read how it works?
 
vitali_yv:
Thanks, where can I read how it works?
I think it's on MSDN
 
vitali_yv:
Thank you, where can I read how it works?
That's Alexei's idea of a joke. The MT4 help is all there.
 
Zhunko:
This is Alexei joking. The MT4 help is all there.
Yes, the description and purpose of the window is there.
But I answered about using it from the code. and you can't do it without API.
 
sergeev:
yes, the description and purpose of the window is there.
But I answered about the use from the code. and you can't do it without API.
:-)) Growing up readers of this thread. They're already asking such questions...
 
How do you find out the lowest and lowest price between 5 and 8am today?
 

Hi! Can you please prescribe how to open an order in an EA, so that when the conditions to open an order once open the order, the next time it will open only when forming the opposite conditions?

 
ZZZEROXXX:

1. How do you determine the profit/loss of the last trade?

2. In the tester, are the results shown including the spread, or do I need to subtract the spread from each trade?


1. I am showing you an example of code organization in my owl:

int time = 0;  // время (разместить в глобальных переменных (до старта) - факт работы только с последним закрытым ордером


//---Поиск последнего отработавшего ордера для открытия очередной позиции ---
   
   for (orderIndex = (OrdersHistoryTotal() - 1); orderIndex >= 0; orderIndex--)
   {   
      if (!OrderSelect(orderIndex, SELECT_BY_POS, MODE_HISTORY))
      {
         Print("Ошибка при доступе к исторической базе (",GetLastError(),")");
         continue;
      }
   
      if ((OrderSymbol() != Symbol()) || (OrderMagicNumber() != MagicNumber))
      {
         continue;
      }
      
        
   //-------------------------Принимаем в расчет только ордер, закрытый недавно-----------------------
if(time<OrderCloseTime())     //(сравниваем его с хранящимся в пероеменной time) 
  {
    time=OrderCloseTime();     //если время закрытия ордера больше - ложим его в переменную
         
         
     
         int lastType = OrderType();
         double lastLots = OrderLots();
         double lastProfit = OrderProfit() + OrderSwap();
         
        // Print ("lastProfit = ", NormalizeDouble(lastProfit, 1));
         
       
         
         // Анализ только что закрывшегося ордера
      
         if (lastProfit >= 0.0)
         {
  //---Ордер закрылся с прибылью - сюда действия при выполнении этого условия
         }
         else
         {
            // Ордер закрылся с убытком - сюда действия при выполнении этого условия (дальше фигурные скобочки сами расставите).
.....
.....
.....
 
           

2. With the spread taken into account, click on the Symbol label in the Strategy Tester window at the top right and read the contents of the drop-down window.

 
maryan.dirtyn:
How do you find out the highest and lowest price between 5 and 8am today?
via iHighest/iLowest
 
SeALALex:

Hi! Can you please prescribe how to open an order in an EA, so that when the conditions to open an order once open the order, the next time it will open only when the opposite conditions are formed?

Do you want to count the number of your orders?
Reason: