JK_BullP_AutoTrader2

Author: Copyright � 2005, Johnny Kor
Profit factor:
0.06
Orders Execution
Checks for the total of open ordersIt can change open orders parameters, due to possible stepping strategyIt automatically opens orders when conditions are reached
Indicators Used
Bulls Power indicator
2 Views
0 Downloads
0 Favorites
JK_BullP_AutoTrader2
//+------------------------------------------------------------------+
//|                                          JK_BullP_AutoTrader.mq4 |
//|                                     Copyright © 2005, Johnny Kor |
//|                                                   autojk@mail.ru |
//|        On-Line Testing http://vesna.on-plus.ru/forex/stat/69740/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, Johnny Kor"
#property link      "autojk@mail.ru"
//---- input parameters
extern double TakeProfit = 500;
extern double Lots = 8.5;
extern double StopLoss = 20;
extern int TrailingStop = 10;
extern double Patr = 1, Prange = 1, Kstop = 0.1, kts = 2, Vts = 2; 
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
   double pos1pre, pos2cur, hzbul1, hzbul2, hzbear1, hzbear2;
   int cnt, ticket, total, TotalOpenOrders;
   pos1pre = iBullsPower(NULL, 0, 13, PRICE_CLOSE, 2);
   pos2cur = iBullsPower(NULL, 0, 13, PRICE_CLOSE, 1);
   total = OrdersTotal();
   int H, L;
   for(cnt = 0; cnt < 30; cnt++)
     {
       if(H == 0)
         {
           if(H < High[cnt]) 
               H = High[cnt];
         }
     }
   for(cnt = 0; cnt < 30; cnt++)
     {
       if(L == 0)
         {
           if(L > Low[cnt]) 
               L = Low[cnt];
         }
     }
   Comment("  BullsPower - ", pos1pre, "  BearsPower - ", pos2cur);
   int j;
   for(cnt = 0; cnt < total; cnt++)
     {
       OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
       if(OrderType() <= OP_SELL && // ýòî îòêðûòàÿ ïîçèöèÿ? OP_BUY èëè OP_SELL 
          OrderSymbol() == Symbol())    // èíñòðóìåíò ñîâïàäàåò?
         {
           j = 2;
           if(OrderType() == OP_BUY)   // îòêðûòà äëèííàÿ ïîçèöèÿ
             {
               // ïðîâåðèì - ìîæåò ìîæíî/íóæíî óæå òðåéëèíã ñòîï ñòàâèòü?
               if(TrailingStop > 0)  // ïîëüçîâàòåëü âûñòàâèë â íàñòðîéêàõ òðåéëèíãñòîï
                 {                 // çíà÷èò ìû èäåì åãî ïðîâåðÿòü
                   if(Bid- OrderOpenPrice() > Point*TrailingStop)
                     {
                       if(OrderStopLoss() < Bid - Point*TrailingStop)
                         {
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Bid-Point*TrailingStop, 
                                       OrderTakeProfit(), 0, Red);
                           return(0);
                         }
                     }
                 }
             }
           else // èíà÷å ýòî êîðîòêàÿ ïîçèöèÿ
             {
               // ïðîâåðèì - ìîæåò ìîæíî/íóæíî óæå òðåéëèíã ñòîï ñòàâèòü?
               if(TrailingStop > 0)  // ïîëüçîâàòåëü âûñòàâèë â íàñòðîéêàõ òðåéëèíãñòîï
                 {                 // çíà÷èò ìû èäåì åãî ïðîâåðÿòü
                   if((OrderOpenPrice() - Ask) > (Point*TrailingStop))
                     {
                       if(OrderStopLoss() == 0.0 || 
                          OrderStopLoss() > (Ask + Point*TrailingStop))
                         {
                           OrderModify(OrderTicket(), OrderOpenPrice(), 
                                       Ask + Point*TrailingStop, 
                                       OrderTakeProfit(), 0, Red);
                           return(0);
                         }
                     }
                 }
             }
         }
     }
   if(pos1pre > pos2cur && pos2cur > 0  && j < 2)
     {
       OrderSend(Symbol(), OP_SELL, Lots, Bid, 3, Bid + StopLoss*Point, 
                 Bid - TakeProfit*Point, NULL, 0, 0, Red);
     }   
   if(pos2cur < 0 && j < 1)
     {
       OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask - StopLoss*Point, 
                 Ask + TakeProfit*Point, NULL, 0, 0, Red);
     }
   return(0);
  }
//+------------------------------------------------------------------+

Profitability Reports

NZD/USD Oct 2024 - Jan 2025
0.06
Total Trades 58
Won Trades 4
Lost trades 54
Win Rate 6.90 %
Expected payoff -148.60
Gross Profit 535.50
Gross Loss -9154.50
Total Net Profit -8619.00
-100%
-50%
0%
50%
100%

Comments