Sfoglia il codice sorgente

Few Changes in the code.

Uzair Tahir 6 mesi fa
parent
commit
010d9d74f0
2 ha cambiato i file con 16 aggiunte e 10 eliminazioni
  1. BIN
      V2/CribMarketEAV2.ex5
  2. 16 10
      V2/CribMarketEAV2.mq5

BIN
V2/CribMarketEAV2.ex5


+ 16 - 10
V2/CribMarketEAV2.mq5

@@ -38,7 +38,7 @@ input       int                  maxOpenPositions      = 3;                // Ma
38
 
38
 
39
 string goldPairs[];
39
 string goldPairs[];
40
 int totalGoldPairs = 0;
40
 int totalGoldPairs = 0;
41
-int timmer = 0;
41
+int timer = 0;
42
 //+------------------------------------------------------------------+
42
 //+------------------------------------------------------------------+
43
 //| Expert initialization function                                   |
43
 //| Expert initialization function                                   |
44
 //+------------------------------------------------------------------+
44
 //+------------------------------------------------------------------+
@@ -88,8 +88,8 @@ void OnTick()
88
 void OnTimer()
88
 void OnTimer()
89
   {
89
   {
90
 //---
90
 //---
91
-   timmer++;
92
-   Print("<><><><><><><> Timer Start: ",timmer," <><><><><><><>");
91
+   timer++;
92
+   Print("<><><><><><><> Timer Start: ",timer," <><><><><><><>");
93
 
93
 
94
    removeFromStruct();
94
    removeFromStruct();
95
 
95
 
@@ -127,7 +127,7 @@ void OnTimer()
127
       addToStructure(buyTickett, sellTickett, symbolToBuy, symbolToSell);
127
       addToStructure(buyTickett, sellTickett, symbolToBuy, symbolToSell);
128
      }
128
      }
129
 
129
 
130
-   Print("<><><><><><><> Timer End: ",timmer," <><><><><><><>");
130
+   Print("<><><><><><><> Timer End: ",timer," <><><><><><><>");
131
 
131
 
132
   }
132
   }
133
 //+------------------------------------------------------------------+
133
 //+------------------------------------------------------------------+
@@ -156,8 +156,8 @@ int placeBuyTrade(string symbol)
156
 
156
 
157
    double ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
157
    double ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
158
    double buySL = 0, buyTP = 0;
158
    double buySL = 0, buyTP = 0;
159
-
160
-   if(trade.PositionOpen(symbol, ORDER_TYPE_BUY, lotSize, ask, buySL, buyTP, "Buy Trade Placed"))
159
+   int count=noOfActiveCombinations()+1;
160
+   if(trade.PositionOpen(symbol, ORDER_TYPE_BUY, lotSize, ask, buySL, buyTP, "Buy Trade Placed # "+(string)timer))
161
      {
161
      {
162
       Print("Buy Trade Placed on ", symbol, ": ", trade.ResultOrder());
162
       Print("Buy Trade Placed on ", symbol, ": ", trade.ResultOrder());
163
       return (int)trade.ResultOrder();
163
       return (int)trade.ResultOrder();
@@ -176,8 +176,8 @@ int placeSellTrade(string symbol)
176
 
176
 
177
    double bid = SymbolInfoDouble(symbol, SYMBOL_BID);
177
    double bid = SymbolInfoDouble(symbol, SYMBOL_BID);
178
    double sellSL = 0, sellTP = 0;
178
    double sellSL = 0, sellTP = 0;
179
-
180
-   if(trade.PositionOpen(symbol, ORDER_TYPE_SELL, lotSize, bid, sellSL, sellTP, "Sell Trade Placed"))
179
+   int count=noOfActiveCombinations()+1;
180
+   if(trade.PositionOpen(symbol, ORDER_TYPE_SELL, lotSize, bid, sellSL, sellTP, "Sell Trade Placed # "+(string)timer))
181
      {
181
      {
182
       Print("Sell Trade Placed on ", symbol, ": ", trade.ResultOrder());
182
       Print("Sell Trade Placed on ", symbol, ": ", trade.ResultOrder());
183
       return (int)trade.ResultOrder();
183
       return (int)trade.ResultOrder();
@@ -201,6 +201,7 @@ void getSymbolsFromMarketWatch()
201
      {
201
      {
202
       string symbolName = SymbolName(i, true);
202
       string symbolName = SymbolName(i, true);
203
       //if(StringFind(symbolName, "GOLD") != -1 || StringFind(symbolName, "XAU") != -1)
203
       //if(StringFind(symbolName, "GOLD") != -1 || StringFind(symbolName, "XAU") != -1)
204
+      if(symbolName!="XAUUSD#")
204
         {
205
         {
205
          ArrayResize(goldPairs, totalGoldPairs + 1);
206
          ArrayResize(goldPairs, totalGoldPairs + 1);
206
          if(totalGoldPairs < ArraySize(goldPairs))
207
          if(totalGoldPairs < ArraySize(goldPairs))
@@ -301,14 +302,19 @@ void checkBasketTakeProfit()
301
 
302
 
302
          if(PositionSelectByTicket(newTradeStore[i].buyTicket))
303
          if(PositionSelectByTicket(newTradeStore[i].buyTicket))
303
            {
304
            {
304
-            combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
305
+            Print("Ticket:",newTradeStore[i].buyTicket);
306
+            Print("Profit:",PositionGetDouble(POSITION_PROFIT), " Swap:",PositionGetDouble(POSITION_SWAP));
307
+            combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP) ;
305
            }
308
            }
306
 
309
 
307
          if(PositionSelectByTicket(newTradeStore[i].sellTicket))
310
          if(PositionSelectByTicket(newTradeStore[i].sellTicket))
308
            {
311
            {
312
+           
313
+            Print("Ticket:",newTradeStore[i].sellTicket);
314
+            Print("Profit:",PositionGetDouble(POSITION_PROFIT), " Swap:",PositionGetDouble(POSITION_SWAP));
309
             combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
315
             combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
310
            }
316
            }
311
-           
317
+
312
          if(combinationProfit >= basketTakeProfit)
318
          if(combinationProfit >= basketTakeProfit)
313
            {
319
            {
314
             Print("Combination TP hit: Closing trades. Profit = ", combinationProfit);
320
             Print("Combination TP hit: Closing trades. Profit = ", combinationProfit);