WajeehSaqib-MQL преди 6 месеца
родител
ревизия
1318839b09
променени са 2 файла, в които са добавени 25 реда и са изтрити 11 реда
  1. BIN
      V2/CribMarketEAV2.ex5
  2. 25 11
      V2/CribMarketEAV2.mq5

BIN
V2/CribMarketEAV2.ex5


+ 25 - 11
V2/CribMarketEAV2.mq5

@@ -33,12 +33,12 @@ input       int                  magicNo               = 333;                 //
33
 input       double               lotSize               = 0.01;                 // Lot Size
33
 input       double               lotSize               = 0.01;                 // Lot Size
34
 input       bool                 enableBasketTP        = true;               // Enable Basket TP
34
 input       bool                 enableBasketTP        = true;               // Enable Basket TP
35
 input       double               basketTakeProfit      = 1.0;               // Basket Take Profit
35
 input       double               basketTakeProfit      = 1.0;               // Basket Take Profit
36
-input       int                  maxOpenPositions      = 3;                // Maximum number of open positions
36
+input       int                  maxOpenPositions      = 3;                // Maximum number of Combinations
37
 
37
 
38
 
38
 
39
 string goldPairs[];
39
 string goldPairs[];
40
 int totalGoldPairs = 0;
40
 int totalGoldPairs = 0;
41
-
41
+int timmer = 0;
42
 //+------------------------------------------------------------------+
42
 //+------------------------------------------------------------------+
43
 //| Expert initialization function                                   |
43
 //| Expert initialization function                                   |
44
 //+------------------------------------------------------------------+
44
 //+------------------------------------------------------------------+
@@ -88,6 +88,8 @@ void OnTick()
88
 void OnTimer()
88
 void OnTimer()
89
   {
89
   {
90
 //---
90
 //---
91
+   timmer++;
92
+   Print("<><><><><><><> Timer Start: ",timmer," <><><><><><><>");
91
 
93
 
92
    removeFromStruct();
94
    removeFromStruct();
93
 
95
 
@@ -124,6 +126,9 @@ void OnTimer()
124
      {
126
      {
125
       addToStructure(buyTickett, sellTickett, symbolToBuy, symbolToSell);
127
       addToStructure(buyTickett, sellTickett, symbolToBuy, symbolToSell);
126
      }
128
      }
129
+
130
+   Print("<><><><><><><> Timer End: ",timmer," <><><><><><><>");
131
+
127
   }
132
   }
128
 //+------------------------------------------------------------------+
133
 //+------------------------------------------------------------------+
129
 //|                                                                  |
134
 //|                                                                  |
@@ -228,7 +233,7 @@ string getSymbolWithLowestAsk()
228
    for(int i = 0; i < totalGoldPairs; i++)
233
    for(int i = 0; i < totalGoldPairs; i++)
229
      {
234
      {
230
       double currentAsk = SymbolInfoDouble(goldPairs[i], SYMBOL_ASK);
235
       double currentAsk = SymbolInfoDouble(goldPairs[i], SYMBOL_ASK);
231
-      Print("Pair:",goldPairs[i]," Price Ask:",currentAsk);
236
+      Print(" Ask Price: ",currentAsk," || on Pair: ",goldPairs[i]);
232
 
237
 
233
       if(currentAsk < lowestAsk)
238
       if(currentAsk < lowestAsk)
234
         {
239
         {
@@ -237,7 +242,7 @@ string getSymbolWithLowestAsk()
237
         }
242
         }
238
      }
243
      }
239
 
244
 
240
-   Print("Lowest Ask Pair: ", lowestSymbol, " Lowest Ask: ", lowestAsk);
245
+   Print("Lowest Ask Pair: ", lowestSymbol, " || Lowest Ask: ", lowestAsk);
241
    return lowestSymbol;
246
    return lowestSymbol;
242
   }
247
   }
243
 
248
 
@@ -257,7 +262,7 @@ string getSymbolWithHighestBid()
257
    for(int i = 0; i < totalGoldPairs; i++)
262
    for(int i = 0; i < totalGoldPairs; i++)
258
      {
263
      {
259
       double currentBid = SymbolInfoDouble(goldPairs[i], SYMBOL_BID);
264
       double currentBid = SymbolInfoDouble(goldPairs[i], SYMBOL_BID);
260
-      Print("Pair:",goldPairs[i]," Price Bid:",currentBid);
265
+      Print(" Bid Price: ",currentBid," || on Pair: ",goldPairs[i]);
261
       if(currentBid > highestBid)
266
       if(currentBid > highestBid)
262
         {
267
         {
263
          highestBid = currentBid;
268
          highestBid = currentBid;
@@ -265,7 +270,7 @@ string getSymbolWithHighestBid()
265
         }
270
         }
266
      }
271
      }
267
 
272
 
268
-   Print("Highest Bid Pair: ", highestSymbol, " Highest Bid: ", highestBid);
273
+   Print("Highest Bid Pair: ", highestSymbol, " || Highest Bid: ", highestBid);
269
    return highestSymbol;
274
    return highestSymbol;
270
   }
275
   }
271
 //+------------------------------------------------------------------+
276
 //+------------------------------------------------------------------+
@@ -303,15 +308,24 @@ void checkBasketTakeProfit()
303
            {
308
            {
304
             combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
309
             combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
305
            }
310
            }
306
-
311
+           
307
          if(combinationProfit >= basketTakeProfit)
312
          if(combinationProfit >= basketTakeProfit)
308
            {
313
            {
309
             Print("Combination TP hit: Closing trades. Profit = ", combinationProfit);
314
             Print("Combination TP hit: Closing trades. Profit = ", combinationProfit);
310
 
315
 
311
-            trade.PositionClose(newTradeStore[i].buyTicket);
312
-            Print("Buy Trade Closed: ", newTradeStore[i].buyTicket);
313
-            trade.PositionClose(newTradeStore[i].sellTicket);
314
-            Print("Sell Trade Closed: ", newTradeStore[i].sellTicket);
316
+            if(!trade.PositionClose(newTradeStore[i].buyTicket))
317
+              {
318
+               Print(" Error Closing Buy Trade : ", newTradeStore[i].buyTicket," ",GetLastError());
319
+              }
320
+            else
321
+               Print("Buy Trade Closed: ", newTradeStore[i].buyTicket);
322
+
323
+            if(!trade.PositionClose(newTradeStore[i].sellTicket))
324
+              {
325
+               Print(" Error Closing Sell Trade : ", newTradeStore[i].sellTicket," ",GetLastError());
326
+              }
327
+            else
328
+               Print("Sell Trade Closed: ", newTradeStore[i].sellTicket);
315
            }
329
            }
316
         }
330
         }
317
      }
331
      }