learn how to earn money villagers [Episode 2] ! - page 234

 
Roman.:

:-)

Yeah, more like the lady who pays my ayron... :-)


I think she'll still be able to do it, but you have to get off on time and unfortunately you can't guess when.

 
7Konstantin7:

While I have no energy to look for it, I've been searching my eyes in a pile for hours)


Don't sweat it, Kostyan - she's got enough leaks - don't bother looking for them... :-)
 
7Konstantin7:

I think she'll still be able to chop it, but you have to get off in time - unfortunately, you can't guess when.



Well, she won't let you in on time... :-)
 

KimIV has what it needs, but monitors only SL, and TP does not.

The Expert Advisor closes only those positions for which the loss in pips has exceeded a certain specified value. Which positions to close, buying or selling, as well as on which trading instruments, can be set using external parameters of the Expert Advisor:

 
Roman.:

She won't let you in on time... :-)

I have not really followed all that, but one thing I know for sure, no matter what kind of pammers there is no point in investing anywhere, anyway, no good will come of it) the market is evil)

 
7Konstantin7:

KimIV has what it needs, but monitors only SL, and TP does not.

The Expert Advisor closes only those positions in which the loss in pips has exceeded a certain specified value. Which positions to close, buying or selling, and on which trading instruments, can be set using external parameters of the Expert Advisor:


Add to your owl - I have organised it this way:


...
 // ------------------------------------------------Ищем наш ордер---------------------------------
   int orderType;
   for (int orderIndex = (OrdersTotal() - 1); orderIndex >= 0; orderIndex--)
   {
      if (!OrderSelect(orderIndex, SELECT_BY_POS))     continue; // если ордер не выбран, то идем на следующий открытый
      if(OrderCloseTime()!=0) continue;                    // если тикет принадлежит закрытому ордеру, то берем следующий открытый
      if ((OrderSymbol() != Symbol()) || (OrderMagicNumber() != MagicNumber)) continue;
      orderType = OrderType();
      if ((orderType != OP_BUY) && (orderType != OP_SELL)) continue;
          ticket = OrderTicket( );                         // Номер ордера
          orderLots = OrderLots();                         // Lots   
          orderProfit = OrderProfit() + OrderSwap();       // Profit
          Price = OrderOpenPrice();                        // Цена открытия рыночного ордера
          SL =  OrderStopLoss();                           // Значение StopLoss ордера
          TP = OrderTakeProfit();                          // Значение TakeProfit ордера          
          if (ticket>0)                                    // Если позиция открылась
              {
                while(OrderSelect(ticket,SELECT_BY_TICKET)==false)       // Если ордер выбран
                Sleep(100);                                 
                double OpenPrice=OrderOpenPrice();
       // Print("OrderTicket()=",OrderTicket(),  "OrderOpenTime()=",OrderOpenTime()); 
       // Print("TimeLocal()=",TimeLocal());                                                                    
                     //---------------------Запоминаем значения сл и тп ордера                     
                if (orderType == OP_BUY) 
                   {                
                     V_StopLossPips = NormalizeDouble(OpenPrice  - (StopLossPips * Point), Digits);
                     V_TakeProfitPips = NormalizeDouble(OpenPrice + (TakeProfitPips * Point), Digits);
                   }
            
                if (orderType == OP_SELL) 
                   {        
                     V_StopLossPips = NormalizeDouble(OpenPrice  + (StopLossPips * Point), Digits);
                     V_TakeProfitPips = NormalizeDouble(OpenPrice - (TakeProfitPips * Point), Digits);
                   }   
                            
              }
             
     // Проверка на предельную просадку      
      double loss = - ((orderProfit * 100.0) / AccountBalance());
      if (loss > MaxLoss)
      {
         Print ("MaxLoss");
         CloseAllOrders(MagicNumber);
         IsExpertFailed = true;
         return (0);
      }
    
       // Проверка закрытия открытой позиции (ордера) по стоп-лоссу           
      if ( V_StopLossPips != 0 )
        {
          if (OrderType() == OP_BUY && Bid <=  V_StopLossPips)  { CloseAllOrders(MagicNumber); Print (" Buy закрываем по сл, V_StopLossPips = ", V_StopLossPips); }             
          if (OrderType()== OP_SELL && Ask >=  V_StopLossPips)  { CloseAllOrders(MagicNumber); Print (" Sell закрываем по сл, V_StopLossPips = ", V_StopLossPips);}  
        }         
        
        // Проверка закрытия открытой позиции (ордера) по тейку        
        if ( V_TakeProfitPips != 0 && MathAbs(orderProfit) > MathAbs (Sum_Loss))
        {
          if (OrderType() == OP_BUY && Bid >=  V_TakeProfitPips)  { CloseAllOrders(MagicNumber); Print ("Buy закрываем по ТР, V_TakeProfitPips = ", V_TakeProfitPips); }             
          if (OrderType()== OP_SELL && Ask <=  V_TakeProfitPips)  { CloseAllOrders(MagicNumber); Print ("Sell закрываем по ТР,V_TakeProfitPips = ", V_TakeProfitPips); }  
        }        
      
      
      // Если тралить, то с соответствующего номера итерации при выполнении НЕОБХОДИМОГО УСЛОВИЯ соответствующим 
      // выбранному видом трала      
      
      if (UseTrailing==1) if ((Iteration >= k)&& (MathAbs(orderProfit) > (MathAbs (Sum_Loss))))
         switch(type)
          {
           case 0:  // простой трал по аналогии учебнику - в зависимости от параметра trlinloss (тралить ли в зоне лоссов)
                   if (orderType == OP_BUY)  SampleTrailing_texbook (0, V_StopLossPips, V_TakeProfitPips); // если бай
                   if (orderType == OP_SELL) SampleTrailing_texbook (1, V_StopLossPips, V_TakeProfitPips); // если селл
                   break;
           //трал по фракталам + отступ (Indent)
           case 1: TrailingByFractals_LAVINA(ticket,s_signal_period,Sum_Loss,Lots_New,V_StopLossPips,trlinloss); break; 
            //трал по теням N свечей + отступ (Indent)       
           case 2: TrailingByShadows  (ticket,s_signal_period,Sum_Loss,Lots_New,V_StopLossPips,trlinloss);  break;   
          }           
       
   //-----------------------------------ВЫВОДИМ ТЕКУЩУЮ ИНФОРМАЦИЮ О ТОРГАХ НА ЭКРАН------------------------------------------------------------ 
     
      string messageLoss = "";
      if (orderProfit < 0.0)  messageLoss = "Просадка = " + DoubleToStr(loss, 1) + "% (макс. " + MaxLoss + "%)";
   
      // Вывод текущего состояния
      Comment("Прибыль = ", DoubleToStr(orderProfit, 1), " (лот ", orderLots, ")  ", messageLoss, " Iteration= ", Iteration, "  Sum_Loss = ", MathAbs (Sum_Loss), " Ширина канала = ", StopLossPips, " TakeProfitPips  = ",TakeProfitPips,  " V_TakeProfitPips = ", V_TakeProfitPips, "  V_StopLossPips = ",  V_StopLossPips, " channel  = ", channel);      
      return (0);
   }
   
   Comment ("");   
...
 
7Konstantin7:

I have not kept track of all that, but one thing I know for sure, no matter what kind of pammers there is no point in investing anywhere, anyway, no good will come of it) the market is evil)


Don't tell me, Kostyan - Paukas, IMHO - rules!!!!

I will be charging dough to him very soon...

 
Roman.:

Add to your owl - I organised it this way:

Thanks, but I've got semi decompiled, whatever) I'll think of something.

when i have a strong movement (it already happened), price goes beyond SL or TP and nothing modifies it

i have tested this at the beginning of this year and i'm still using min lot

So far 2 days working

 
Roman.:

Don't tell me, Kostyan - Paukas, IMHO - rules!!!!

I'll be charging dough to him real soon...

Aha saw) Well, maybe, it's just that to get something to invest a little, and if you invest a lot of dough, the same scary) especially if there were bad investments, as it is not very fun to trust.

 
7Konstantin7:

Hello all)

Comrades advise, searched for hours all in vain, the similar sea, but all not that(

Do you have an Expert Advisor? I don't know if there is an EA which follows each order separately for all pairs.


Look at this, https://www.mql5.com/ru/code/10914, to make it work for all pairs you need to delete lines
if(OrderSymbol()==Symbol())
Reason: