Greeting kind colleagues
iv come across so many grid ea's but most of them are all "buy stop /sell stop orders" @ x pips away from market price ...
Please can someone direct me to an ea or script that uses limit orders instead.... being able to set the distance between say 5 orders in pips, with a stop loss and take profit function ...
OR
this is MGRID v7 Found on forexfactory, i tried to do it but didnt now how to do it...
This is what im after but it has two main issues ...
1. the levels are fine until the market moves a tick then it adds multiple new pending orders infinitely... i just want it to keep the original levels as preselected and not open any more
2. please, can the buy stops be changed to sell limit orders... and all sell stops changed to buy limit orders
thats it prayer emoji*
im a noob at coding so any edits please can you post full code with headers n footers so i can copy and paste ea
Thank you...
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//---- EA input parameters
extern double Lots = 0.01; // Starting levels pips
extern double MarginStop = 200.0; // Stop at margin level
extern int Pips = 50; // Number of pips between each level
extern int Levels = 2; // Number of levels of the pending orders
extern int ProfitTarget = 400; // Minimum profit target, in pips.
extern bool ContinueTrading = true;
extern bool UseEntryTime = false;
extern int EntryTime = 0;
int First_Target = 0;
int Target_Increment = 0;
bool RunAsLoop = false;
//+------------------------------------------------------------------+
//---- EA variables
int Leverage, nextTP,
NumBuys, NumSells, TotalTrades,
NumBuyOrders, NumSellOrders, TotalOrders;
double templots, Investment, MarginLevel,
BuyGoal, SellGoal, BuyGoalProfit, SellGoalProfit;
string MarginLevelStr, AccountTypeString;
bool Enter = true, LotsTooSmall, AccountIsMini;
int Magic=1803979;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
nextTP = First_Target;
while (RunAsLoop) // infinite loop for main program
{
if (IsConnected()) main();
PrintComments();
Sleep(1000); // give your PC a breath
}
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
int start()
{
if (!RunAsLoop)
{
main();
PrintComments();
}
return(0);
}
//+------------------------------------------------------------------+
//| expert main function |
//+------------------------------------------------------------------+
int main()
{
int ticket, cpt, profit, total = 0, PipsLot;
double spread = (Ask-Bid)/Point, InitialPrice = 0;
BuyGoal = 0.0;
SellGoal = 0.0;
BuyGoalProfit = 0.0;
SellGoalProfit = 0.0;
if (AccountMargin() > 0.0)
MarginLevel = 100.0 * (AccountEquity() / AccountMargin());
else
MarginLevel = 0.0;
MarginLevelStr = DoubleToStr(MarginLevel, 2);
if(Pips < MarketInfo(Symbol(), MODE_STOPLEVEL)+spread) Pips = 1+MarketInfo(Symbol(), MODE_STOPLEVEL) + spread;
CountOrdersAndTrades();
{
for(cpt=1; cpt<Levels; cpt++) PipsLot += cpt*Pips;
//+------------------------------------------------------------------+
//check Initial Price
for(cpt=0;cpt<OrdersTotal();cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_TRADES);
if(OrderMagicNumber()==Magic && OrderSymbol()==Symbol())
{
total++;
if(!InitialPrice) InitialPrice=StrToDouble(OrderComment());
}}
if (MarginLevel > 0.0 && MarginLevel < MarginStop)
{
Print("Not enough free margin to place orders.");
return(0);
}
if(TotalTrades + TotalOrders == 0 &&
total < 1 && Enter && (!UseEntryTime || (UseEntryTime && Hour() == EntryTime)))
{
//+------------------------------------------------------------------+
// Set up a new grid
InitialPrice = Ask;
SellGoal = InitialPrice-(Levels+1)*Pips*Point;
BuyGoal = InitialPrice+(Levels+1)*Pips*Point;
for(cpt = 1; cpt <= Levels; cpt++)
{
OrderSend(Symbol(),OP_BUYSTOP,Lots,InitialPrice+cpt*Pips*Point,2,SellGoal,BuyGoal,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Blue);
Sleep(1000);
OrderSend(Symbol(),OP_SELLSTOP,Lots,InitialPrice-cpt*Pips*Point,2,
BuyGoal+spread*Point,SellGoal+spread*Point,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Red);
Sleep(1000);
}}
//+------------------------------------------------------------------+
// Initial setup done
else
{
BuyGoal = InitialPrice+Pips*(Levels+1)*Point;
SellGoal = InitialPrice-Pips*(Levels+1)*Point;
total = OrdersHistoryTotal();
for (cpt = 0; cpt < total; cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_HISTORY);
if (OrderMagicNumber() == Magic && OrderSymbol() == Symbol() &&
StrToDouble(OrderComment()) == InitialPrice)
{
EndSession();
return(0);
}}
BuyGoalProfit = CheckProfits(Lots,OP_BUY,false,InitialPrice);
SellGoalProfit = CheckProfits(Lots,OP_SELL,false,InitialPrice);
if (BuyGoalProfit < ProfitTarget)
{
for (cpt = Levels; cpt >= 1 && BuyGoalProfit < ProfitTarget; cpt--)
{
if (Ask <= (InitialPrice+(cpt*Pips-MarketInfo(Symbol(),MODE_STOPLEVEL))*Point))
{
//+------------------------------------------------------------------+
templots = Lots*3;
ticket = OrderSend(Symbol(),OP_BUYSTOP,templots,InitialPrice+cpt*Pips*Point,2,SellGoal,BuyGoal,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Blue);
Sleep(1000);
}
if (ticket > 0)
BuyGoalProfit += Lots*(BuyGoal-InitialPrice-cpt*Pips*Point)/Point;
}}
if (SellGoalProfit < ProfitTarget)
{
for (cpt = Levels; cpt >= 1 && SellGoalProfit < ProfitTarget; cpt--)
{
if (Bid >= (InitialPrice-(cpt*Pips-MarketInfo(Symbol(),MODE_STOPLEVEL))*Point))
{
//+------------------------------------------------------------------+
templots = Lots*3;
ticket = OrderSend(Symbol(),OP_SELLSTOP,templots,InitialPrice-cpt*Pips*Point,2,BuyGoal+spread*Point,SellGoal+spread*Point,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Red);
Sleep(1000);
}
if (ticket > 0)
SellGoalProfit += Lots*(InitialPrice-cpt*Pips*Point-SellGoal-spread*Point)/Point;
}}}
return(0);
}}
//+------------------------------------------------------------------+
void PrintComments()
{
string sComment = "";
string sep = "----------------------------------------\n";
string nl = "\n";
sComment = sComment + sep;
sComment = sComment + "Date: "+Month()+"-"+Day()+"-"+Year()+" Server Time: "+Hour()+":"+Minute()+":"+Seconds() + nl;
sComment = sComment + sep;
sComment = sComment + "Lots=" + DoubleToStr(Lots,1) + " | Pips=" + Pips + " | Levels: " + Levels + nl;
sComment = sComment + "MarginStop=" + MarginStop + "%" + nl;
sComment = sComment + sep;
sComment = sComment + "Buy Trades= " + NumBuys + ", Sell Trades= " + NumSells + nl;
sComment = sComment + "Buy Orders= " + NumBuyOrders + ", Sell Orders= " + NumSellOrders + nl;
if (MarginLevel > 0.0 && MarginLevel < MarginStop)
{
sComment = sComment + nl + "NO NEW ORDERS DUE TO MARGIN LEVEL " + MarginStop + "%" + nl + sep;
}
else
{
//sComment = sComment + "Buy Goal= " + DoubleToStr(BuyGoal,5) + nl;
//sComment = sComment + "Buy Goal Profit (in pips)=" + BuyGoalProfit + nl;
//sComment = sComment + "Sell Goal= " + DoubleToStr(SellGoal,5) + nl;
//sComment = sComment + "Sell Goal Profit (in pips)=" + SellGoalProfit + nl;
//sComment = sComment + sep;
}
Comment(sComment);
}
//+------------------------------------------------------------------+
void CountOrdersAndTrades()
{
int cpt;
NumBuys = 0;
NumSells = 0;
TotalTrades = 0;
NumBuyOrders = 0;
NumSellOrders = 0;
TotalOrders = 0;
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
{
if (OrderType() == OP_BUY)
{
NumBuys++;
}
else if (OrderType() == OP_SELL)
{
NumSells++;
}
else if (OrderType() == OP_BUYSTOP)
{
NumBuyOrders++;
}
else if (OrderType() == OP_SELLSTOP)
{
NumSellOrders++;
}}}
TotalTrades = NumBuys + NumSells;
TotalOrders = NumBuyOrders + NumSellOrders;
}
//+------------------------------------------------------------------+
double CheckProfits(double Lots, int Goal, bool Current, double InitialPrice)
{
double profit = 0.0;
int cpt;
if (Current) //return current profit
{
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit += (Bid-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit += (OrderOpenPrice()-Ask)/Point*OrderLots()/Lots;
}}}
return(profit);
}
else
{
if (Goal == OP_BUY)
{
for (cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect (cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit += (OrderTakeProfit()-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit -= (OrderStopLoss()-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_BUYSTOP)
{
profit += (OrderTakeProfit()-OrderOpenPrice())/Point*OrderLots()/Lots;
}}}
return(profit);
}
else
{
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit -= (OrderOpenPrice()-OrderStopLoss())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit += (OrderOpenPrice()-OrderTakeProfit())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELLSTOP)
{
profit += (OrderOpenPrice()-OrderTakeProfit())/Point*OrderLots()/Lots;
}}}
return(profit);
}}}
//+------------------------------------------------------------------+
bool EndSession()
{
int cpt, total = OrdersTotal();
for(cpt=0;cpt<total;cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderType() > 1)
{
OrderDelete(OrderTicket());
}
else if (OrderSymbol() == Symbol() && OrderType() == OP_BUY)
{
OrderClose(OrderTicket(), OrderLots(), Bid, 3, Red);
}
else if (OrderSymbol() == Symbol() && OrderType() == OP_SELL)
{
OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);
}}
if (!ContinueTrading)
{
Enter = false;
}
return(true);
}
iv come across so many grid ea's but most of them are all "buy stop /sell stop orders" @ x pips away from market price ...
Please can someone direct me to an ea or script that uses limit orders instead.... being able to set the distance between say 5 orders in pips, with a stop loss and take profit function ...
OR
this is MGRID v7 Found on forexfactory, i tried to do it but didnt now how to do it...
This is what im after but it has two main issues ...
1. the levels are fine until the market moves a tick then it adds multiple new pending orders infinitely... i just want it to keep the original levels as preselected and not open any more
2. please, can the buy stops be changed to sell limit orders... and all sell stops changed to buy limit orders
thats it prayer emoji*
im a noob at coding so any edits please can you post full code with headers n footers so i can copy and paste ea
Thank you...
//+------------------------------------------------------------------+
#property copyright ""
#property link ""
//---- EA input parameters
extern double Lots = 0.01; // Starting levels pips
extern double MarginStop = 200.0; // Stop at margin level
extern int Pips = 50; // Number of pips between each level
extern int Levels = 2; // Number of levels of the pending orders
extern int ProfitTarget = 400; // Minimum profit target, in pips.
extern bool ContinueTrading = true;
extern bool UseEntryTime = false;
extern int EntryTime = 0;
int First_Target = 0;
int Target_Increment = 0;
bool RunAsLoop = false;
//+------------------------------------------------------------------+
//---- EA variables
int Leverage, nextTP,
NumBuys, NumSells, TotalTrades,
NumBuyOrders, NumSellOrders, TotalOrders;
double templots, Investment, MarginLevel,
BuyGoal, SellGoal, BuyGoalProfit, SellGoalProfit;
string MarginLevelStr, AccountTypeString;
bool Enter = true, LotsTooSmall, AccountIsMini;
int Magic=1803979;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
nextTP = First_Target;
while (RunAsLoop) // infinite loop for main program
{
if (IsConnected()) main();
PrintComments();
Sleep(1000); // give your PC a breath
}
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
return(0);
}
int start()
{
if (!RunAsLoop)
{
main();
PrintComments();
}
return(0);
}
//+------------------------------------------------------------------+
//| expert main function |
//+------------------------------------------------------------------+
int main()
{
int ticket, cpt, profit, total = 0, PipsLot;
double spread = (Ask-Bid)/Point, InitialPrice = 0;
BuyGoal = 0.0;
SellGoal = 0.0;
BuyGoalProfit = 0.0;
SellGoalProfit = 0.0;
if (AccountMargin() > 0.0)
MarginLevel = 100.0 * (AccountEquity() / AccountMargin());
else
MarginLevel = 0.0;
MarginLevelStr = DoubleToStr(MarginLevel, 2);
if(Pips < MarketInfo(Symbol(), MODE_STOPLEVEL)+spread) Pips = 1+MarketInfo(Symbol(), MODE_STOPLEVEL) + spread;
CountOrdersAndTrades();
{
for(cpt=1; cpt<Levels; cpt++) PipsLot += cpt*Pips;
//+------------------------------------------------------------------+
//check Initial Price
for(cpt=0;cpt<OrdersTotal();cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_TRADES);
if(OrderMagicNumber()==Magic && OrderSymbol()==Symbol())
{
total++;
if(!InitialPrice) InitialPrice=StrToDouble(OrderComment());
}}
if (MarginLevel > 0.0 && MarginLevel < MarginStop)
{
Print("Not enough free margin to place orders.");
return(0);
}
if(TotalTrades + TotalOrders == 0 &&
total < 1 && Enter && (!UseEntryTime || (UseEntryTime && Hour() == EntryTime)))
{
//+------------------------------------------------------------------+
// Set up a new grid
InitialPrice = Ask;
SellGoal = InitialPrice-(Levels+1)*Pips*Point;
BuyGoal = InitialPrice+(Levels+1)*Pips*Point;
for(cpt = 1; cpt <= Levels; cpt++)
{
OrderSend(Symbol(),OP_BUYSTOP,Lots,InitialPrice+cpt*Pips*Point,2,SellGoal,BuyGoal,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Blue);
Sleep(1000);
OrderSend(Symbol(),OP_SELLSTOP,Lots,InitialPrice-cpt*Pips*Point,2,
BuyGoal+spread*Point,SellGoal+spread*Point,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Red);
Sleep(1000);
}}
//+------------------------------------------------------------------+
// Initial setup done
else
{
BuyGoal = InitialPrice+Pips*(Levels+1)*Point;
SellGoal = InitialPrice-Pips*(Levels+1)*Point;
total = OrdersHistoryTotal();
for (cpt = 0; cpt < total; cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_HISTORY);
if (OrderMagicNumber() == Magic && OrderSymbol() == Symbol() &&
StrToDouble(OrderComment()) == InitialPrice)
{
EndSession();
return(0);
}}
BuyGoalProfit = CheckProfits(Lots,OP_BUY,false,InitialPrice);
SellGoalProfit = CheckProfits(Lots,OP_SELL,false,InitialPrice);
if (BuyGoalProfit < ProfitTarget)
{
for (cpt = Levels; cpt >= 1 && BuyGoalProfit < ProfitTarget; cpt--)
{
if (Ask <= (InitialPrice+(cpt*Pips-MarketInfo(Symbol(),MODE_STOPLEVEL))*Point))
{
//+------------------------------------------------------------------+
templots = Lots*3;
ticket = OrderSend(Symbol(),OP_BUYSTOP,templots,InitialPrice+cpt*Pips*Point,2,SellGoal,BuyGoal,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Blue);
Sleep(1000);
}
if (ticket > 0)
BuyGoalProfit += Lots*(BuyGoal-InitialPrice-cpt*Pips*Point)/Point;
}}
if (SellGoalProfit < ProfitTarget)
{
for (cpt = Levels; cpt >= 1 && SellGoalProfit < ProfitTarget; cpt--)
{
if (Bid >= (InitialPrice-(cpt*Pips-MarketInfo(Symbol(),MODE_STOPLEVEL))*Point))
{
//+------------------------------------------------------------------+
templots = Lots*3;
ticket = OrderSend(Symbol(),OP_SELLSTOP,templots,InitialPrice-cpt*Pips*Point,2,BuyGoal+spread*Point,SellGoal+spread*Point,
DoubleToStr(InitialPrice,MarketInfo(Symbol(),MODE_DIGITS)),Magic,0,Red);
Sleep(1000);
}
if (ticket > 0)
SellGoalProfit += Lots*(InitialPrice-cpt*Pips*Point-SellGoal-spread*Point)/Point;
}}}
return(0);
}}
//+------------------------------------------------------------------+
void PrintComments()
{
string sComment = "";
string sep = "----------------------------------------\n";
string nl = "\n";
sComment = sComment + sep;
sComment = sComment + "Date: "+Month()+"-"+Day()+"-"+Year()+" Server Time: "+Hour()+":"+Minute()+":"+Seconds() + nl;
sComment = sComment + sep;
sComment = sComment + "Lots=" + DoubleToStr(Lots,1) + " | Pips=" + Pips + " | Levels: " + Levels + nl;
sComment = sComment + "MarginStop=" + MarginStop + "%" + nl;
sComment = sComment + sep;
sComment = sComment + "Buy Trades= " + NumBuys + ", Sell Trades= " + NumSells + nl;
sComment = sComment + "Buy Orders= " + NumBuyOrders + ", Sell Orders= " + NumSellOrders + nl;
if (MarginLevel > 0.0 && MarginLevel < MarginStop)
{
sComment = sComment + nl + "NO NEW ORDERS DUE TO MARGIN LEVEL " + MarginStop + "%" + nl + sep;
}
else
{
//sComment = sComment + "Buy Goal= " + DoubleToStr(BuyGoal,5) + nl;
//sComment = sComment + "Buy Goal Profit (in pips)=" + BuyGoalProfit + nl;
//sComment = sComment + "Sell Goal= " + DoubleToStr(SellGoal,5) + nl;
//sComment = sComment + "Sell Goal Profit (in pips)=" + SellGoalProfit + nl;
//sComment = sComment + sep;
}
Comment(sComment);
}
//+------------------------------------------------------------------+
void CountOrdersAndTrades()
{
int cpt;
NumBuys = 0;
NumSells = 0;
TotalTrades = 0;
NumBuyOrders = 0;
NumSellOrders = 0;
TotalOrders = 0;
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderMagicNumber() == Magic && OrderSymbol() == Symbol())
{
if (OrderType() == OP_BUY)
{
NumBuys++;
}
else if (OrderType() == OP_SELL)
{
NumSells++;
}
else if (OrderType() == OP_BUYSTOP)
{
NumBuyOrders++;
}
else if (OrderType() == OP_SELLSTOP)
{
NumSellOrders++;
}}}
TotalTrades = NumBuys + NumSells;
TotalOrders = NumBuyOrders + NumSellOrders;
}
//+------------------------------------------------------------------+
double CheckProfits(double Lots, int Goal, bool Current, double InitialPrice)
{
double profit = 0.0;
int cpt;
if (Current) //return current profit
{
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if(OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit += (Bid-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit += (OrderOpenPrice()-Ask)/Point*OrderLots()/Lots;
}}}
return(profit);
}
else
{
if (Goal == OP_BUY)
{
for (cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect (cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit += (OrderTakeProfit()-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit -= (OrderStopLoss()-OrderOpenPrice())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_BUYSTOP)
{
profit += (OrderTakeProfit()-OrderOpenPrice())/Point*OrderLots()/Lots;
}}}
return(profit);
}
else
{
for(cpt = 0; cpt < OrdersTotal(); cpt++)
{
OrderSelect(cpt, SELECT_BY_POS, MODE_TRADES);
if (OrderSymbol() == Symbol() && StrToDouble(OrderComment()) == InitialPrice)
{
if (OrderType() == OP_BUY)
{
profit -= (OrderOpenPrice()-OrderStopLoss())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELL)
{
profit += (OrderOpenPrice()-OrderTakeProfit())/Point*OrderLots()/Lots;
}
if (OrderType() == OP_SELLSTOP)
{
profit += (OrderOpenPrice()-OrderTakeProfit())/Point*OrderLots()/Lots;
}}}
return(profit);
}}}
//+------------------------------------------------------------------+
bool EndSession()
{
int cpt, total = OrdersTotal();
for(cpt=0;cpt<total;cpt++)
{
OrderSelect(cpt,SELECT_BY_POS,MODE_TRADES);
if (OrderSymbol() == Symbol() && OrderType() > 1)
{
OrderDelete(OrderTicket());
}
else if (OrderSymbol() == Symbol() && OrderType() == OP_BUY)
{
OrderClose(OrderTicket(), OrderLots(), Bid, 3, Red);
}
else if (OrderSymbol() == Symbol() && OrderType() == OP_SELL)
{
OrderClose(OrderTicket(), OrderLots(), Ask, 3, Red);
}}
if (!ContinueTrading)
{
Enter = false;
}
return(true);
}