|
|
@@ -38,7 +38,7 @@ input int maxOpenPositions = 3; // Ma
|
|
|
|
|
|
string goldPairs[];
|
|
|
int totalGoldPairs = 0;
|
|
|
-int timmer = 0;
|
|
|
+int timer = 0;
|
|
|
//+------------------------------------------------------------------+
|
|
|
//| Expert initialization function |
|
|
|
//+------------------------------------------------------------------+
|
|
|
@@ -88,8 +88,8 @@ void OnTick()
|
|
|
void OnTimer()
|
|
|
{
|
|
|
//---
|
|
|
- timmer++;
|
|
|
- Print("<><><><><><><> Timer Start: ",timmer," <><><><><><><>");
|
|
|
+ timer++;
|
|
|
+ Print("<><><><><><><> Timer Start: ",timer," <><><><><><><>");
|
|
|
|
|
|
removeFromStruct();
|
|
|
|
|
|
@@ -127,7 +127,7 @@ void OnTimer()
|
|
|
addToStructure(buyTickett, sellTickett, symbolToBuy, symbolToSell);
|
|
|
}
|
|
|
|
|
|
- Print("<><><><><><><> Timer End: ",timmer," <><><><><><><>");
|
|
|
+ Print("<><><><><><><> Timer End: ",timer," <><><><><><><>");
|
|
|
|
|
|
}
|
|
|
//+------------------------------------------------------------------+
|
|
|
@@ -156,8 +156,8 @@ int placeBuyTrade(string symbol)
|
|
|
|
|
|
double ask = SymbolInfoDouble(symbol, SYMBOL_ASK);
|
|
|
double buySL = 0, buyTP = 0;
|
|
|
-
|
|
|
- if(trade.PositionOpen(symbol, ORDER_TYPE_BUY, lotSize, ask, buySL, buyTP, "Buy Trade Placed"))
|
|
|
+ int count=noOfActiveCombinations()+1;
|
|
|
+ if(trade.PositionOpen(symbol, ORDER_TYPE_BUY, lotSize, ask, buySL, buyTP, "Buy Trade Placed # "+(string)timer))
|
|
|
{
|
|
|
Print("Buy Trade Placed on ", symbol, ": ", trade.ResultOrder());
|
|
|
return (int)trade.ResultOrder();
|
|
|
@@ -176,8 +176,8 @@ int placeSellTrade(string symbol)
|
|
|
|
|
|
double bid = SymbolInfoDouble(symbol, SYMBOL_BID);
|
|
|
double sellSL = 0, sellTP = 0;
|
|
|
-
|
|
|
- if(trade.PositionOpen(symbol, ORDER_TYPE_SELL, lotSize, bid, sellSL, sellTP, "Sell Trade Placed"))
|
|
|
+ int count=noOfActiveCombinations()+1;
|
|
|
+ if(trade.PositionOpen(symbol, ORDER_TYPE_SELL, lotSize, bid, sellSL, sellTP, "Sell Trade Placed # "+(string)timer))
|
|
|
{
|
|
|
Print("Sell Trade Placed on ", symbol, ": ", trade.ResultOrder());
|
|
|
return (int)trade.ResultOrder();
|
|
|
@@ -201,6 +201,7 @@ void getSymbolsFromMarketWatch()
|
|
|
{
|
|
|
string symbolName = SymbolName(i, true);
|
|
|
//if(StringFind(symbolName, "GOLD") != -1 || StringFind(symbolName, "XAU") != -1)
|
|
|
+ if(symbolName!="XAUUSD#")
|
|
|
{
|
|
|
ArrayResize(goldPairs, totalGoldPairs + 1);
|
|
|
if(totalGoldPairs < ArraySize(goldPairs))
|
|
|
@@ -301,14 +302,19 @@ void checkBasketTakeProfit()
|
|
|
|
|
|
if(PositionSelectByTicket(newTradeStore[i].buyTicket))
|
|
|
{
|
|
|
- combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
|
|
|
+ Print("Ticket:",newTradeStore[i].buyTicket);
|
|
|
+ Print("Profit:",PositionGetDouble(POSITION_PROFIT), " Swap:",PositionGetDouble(POSITION_SWAP));
|
|
|
+ combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP) ;
|
|
|
}
|
|
|
|
|
|
if(PositionSelectByTicket(newTradeStore[i].sellTicket))
|
|
|
{
|
|
|
+
|
|
|
+ Print("Ticket:",newTradeStore[i].sellTicket);
|
|
|
+ Print("Profit:",PositionGetDouble(POSITION_PROFIT), " Swap:",PositionGetDouble(POSITION_SWAP));
|
|
|
combinationProfit += PositionGetDouble(POSITION_PROFIT) + PositionGetDouble(POSITION_SWAP);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(combinationProfit >= basketTakeProfit)
|
|
|
{
|
|
|
Print("Combination TP hit: Closing trades. Profit = ", combinationProfit);
|