|
@@ -13,9 +13,9 @@ CTrade trade;
|
|
|
|
|
|
|
|
input string Settings = " ------------- General Settings ------------- "; //_
|
|
input string Settings = " ------------- General Settings ------------- "; //_
|
|
|
input int magicNo = 333; // Magic no
|
|
input int magicNo = 333; // Magic no
|
|
|
-input double lotSize = 0.1; // Lot Size
|
|
|
|
|
-input bool enableBasketTP = false; // Enable Basket TP
|
|
|
|
|
-input double basketTakeProfit = 150.0; // Basket Take Profit
|
|
|
|
|
|
|
+input double lotSize = 0.01; // Lot Size
|
|
|
|
|
+input bool enableBasketTP = true; // Enable Basket TP
|
|
|
|
|
+input double basketTakeProfit = 1.0; // Basket Take Profit
|
|
|
|
|
|
|
|
|
|
|
|
|
string goldPairs[];
|
|
string goldPairs[];
|
|
@@ -35,7 +35,8 @@ int OnInit()
|
|
|
trade.SetAsyncMode(false);
|
|
trade.SetAsyncMode(false);
|
|
|
|
|
|
|
|
getGoldPairsFromMarketWatch();
|
|
getGoldPairsFromMarketWatch();
|
|
|
-
|
|
|
|
|
|
|
+//--- create timer
|
|
|
|
|
+ EventSetMillisecondTimer(1000);
|
|
|
|
|
|
|
|
//---
|
|
//---
|
|
|
return(INIT_SUCCEEDED);
|
|
return(INIT_SUCCEEDED);
|
|
@@ -46,6 +47,7 @@ int OnInit()
|
|
|
void OnDeinit(const int reason)
|
|
void OnDeinit(const int reason)
|
|
|
{
|
|
{
|
|
|
//---
|
|
//---
|
|
|
|
|
+ EventKillTimer();
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
@@ -55,6 +57,15 @@ void OnTick()
|
|
|
{
|
|
{
|
|
|
//---
|
|
//---
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+//+------------------------------------------------------------------+
|
|
|
|
|
+//| |
|
|
|
|
|
+//+------------------------------------------------------------------+
|
|
|
|
|
+void OnTimer()
|
|
|
|
|
+ {
|
|
|
|
|
+//---
|
|
|
if(enableBasketTP == true)
|
|
if(enableBasketTP == true)
|
|
|
{
|
|
{
|
|
|
checkBasketTakeProfit();
|
|
checkBasketTakeProfit();
|
|
@@ -79,7 +90,6 @@ void OnTick()
|
|
|
placeSellTrade(symbolToSell);
|
|
placeSellTrade(symbolToSell);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|
|
|
//| |
|
|
//| |
|
|
@@ -178,6 +188,8 @@ string getSymbolWithLowestAsk()
|
|
|
for(int i = 0; i < totalGoldPairs; i++)
|
|
for(int i = 0; i < totalGoldPairs; i++)
|
|
|
{
|
|
{
|
|
|
double currentAsk = SymbolInfoDouble(goldPairs[i], SYMBOL_ASK);
|
|
double currentAsk = SymbolInfoDouble(goldPairs[i], SYMBOL_ASK);
|
|
|
|
|
+ Print("Pair:",goldPairs[i]," Price Ask:",currentAsk);
|
|
|
|
|
+
|
|
|
if(currentAsk < lowestAsk)
|
|
if(currentAsk < lowestAsk)
|
|
|
{
|
|
{
|
|
|
lowestAsk = currentAsk;
|
|
lowestAsk = currentAsk;
|
|
@@ -185,7 +197,7 @@ string getSymbolWithLowestAsk()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//Print("Lowest Ask Pair: ", lowestSymbol, " Lowest Ask: ", lowestAsk);
|
|
|
|
|
|
|
+ Print("Lowest Ask Pair: ", lowestSymbol, " Lowest Ask: ", lowestAsk);
|
|
|
return lowestSymbol;
|
|
return lowestSymbol;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -205,6 +217,7 @@ string getSymbolWithHighestBid()
|
|
|
for(int i = 0; i < totalGoldPairs; i++)
|
|
for(int i = 0; i < totalGoldPairs; i++)
|
|
|
{
|
|
{
|
|
|
double currentBid = SymbolInfoDouble(goldPairs[i], SYMBOL_BID);
|
|
double currentBid = SymbolInfoDouble(goldPairs[i], SYMBOL_BID);
|
|
|
|
|
+ Print("Pair:",goldPairs[i]," Price Bid:",currentBid);
|
|
|
if(currentBid > highestBid)
|
|
if(currentBid > highestBid)
|
|
|
{
|
|
{
|
|
|
highestBid = currentBid;
|
|
highestBid = currentBid;
|
|
@@ -212,7 +225,7 @@ string getSymbolWithHighestBid()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-//Print("Highest Bid Pair: ", highestSymbol, " Highest Bid: ", highestBid);
|
|
|
|
|
|
|
+ Print("Highest Bid Pair: ", highestSymbol, " Highest Bid: ", highestBid);
|
|
|
return highestSymbol;
|
|
return highestSymbol;
|
|
|
}
|
|
}
|
|
|
//+------------------------------------------------------------------+
|
|
//+------------------------------------------------------------------+
|