Hello
I have a Proplem with this Particular Code
could anyone look into this .
// ------------------------------------------------------------------
//| This MQL is generated by Expert Advisor Builder |
//| http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/ |
//| |
//| If will author be liable for any damages whatsoever. |
//| Use at your own risk. |
//| |
// ------------------- DO NOT REMOVE THIS HEADER --------------------
#define SIGNAL_NONE 0
#define SIGNAL_BUY 1
#define SIGNAL_SELL Two
#define SIGNAL_CLOSEBUY 3
#define SIGNAL_CLOSESELL 4
#property copyright Expert Advisor Builder
#property Hyperlink http://sufx.core.t3-ism.net/ExpertAdvisorBuilder/
extern int MagicNumber = 0;
extern bool SignalMail = False;
extern bool EachTickMode = False;
extern double Lots = 1.0;
extern int Slippage = 3;
extern bool UseStopLoss = True;
extern int StopLoss = 300;
extern bool UseTakeProfit = True;
extern int TakeProfit = 600;
extern bool UseTrailingStop = True;
extern int TrailingStop = 300;
int BarCount;
int Current;
bool TickCheck = False;
// ------------------------------------------------------------------
//| pro initialization function |
// ------------------------------------------------------------------
int init()
BarCount = Bars;
if (EachTickMode) Current = 0; otherwise Current = 1;
return(0);
// ------------------------------------------------------------------
//| pro deinitialization function |
// ------------------------------------------------------------------
int deinit()
return(0);
// ------------------------------------------------------------------
//| expert begin function |
// ------------------------------------------------------------------
int begin() {
int Order = SIGNAL_NONE;
int Complete, Ticket;
dual StopLossLevel, TakeProfitLevel;
if (EachTickMode Bars ! = BarCount) TickCheck = False;
Complete = OrdersTotal();
Order = SIGNAL_NONE;
// ------------------------------------------------------------------
//| Variable Begin |
// ------------------------------------------------------------------
dual Var1 = iIchimoku(NULL, 0, 9, 26, 52, MODE_CHIKOUSPAN, Current 0);
dual Var2 = iIchimoku(NULL, 0, 9, 26, 52, MODE_TENKANSEN, Current 0);
dual Var3 = iIchimoku(NULL, 0, 9, 26, 52, MODE_KIJUNSEN, Current 0);
dual Buy1_1 = Var1 ;
dual Buy1_2 = iClose(NULL, 0, Current 21);
dual Buy2_1 = Var2 ;
dual Buy2_2 = Var3 ;
dual Sell1_1 = Var1 ;
dual Sell1_2 = iClose(NULL, 0, Current 21);
dual Sell2_1 = Var3 ;
dual Sell2_2 = Var2 ;
// ------------------------------------------------------------------
//| Factor End |
// ------------------------------------------------------------------
//Check position
bool IsTrade = False;
for (int I = 0; I lt; Total; I )
OrderSelect(I, SELECT_BY_POS, MODE_TRADES);
if(OrderType() lt;= OP_SELL OrderSymbol() == Symbol())
IsTrade = True;
if(OrderType() == OP_BUY) Signal End(Exit Buy) else
//Close
// ------------------------------------------------------------------
//
// ------------------------------------------------------------------
//| Signal Begin(Entry) |
// ------------------------------------------------------------------
if (Buy1_1 gt; Buy1_2 Buy2_1 == Buy2_2) Order = SIGNAL_BUY;
if (Sell1_1 lt; Sell1_2 Sell2_1 gt; Sell2_2) Order = SIGNAL_SELL;
// ------------------------------------------------------------------
//| Signal End |
// ------------------------------------------------------------------
//Buy
if (Order == SIGNAL_BUY ((EachTickMode ! TickCheck) || (! EachTickMode (Bars ! = BarCount))))
if(! IsTrade)
//Check free margin
if (AccountFreeMargin() lt; (1000 * Lots))
Print(We have no money. Free Margin = , AccountFreeMargin());
return(0);
if (UseStopLoss) StopLossLevel = Ask - StopLoss * Stage; otherwise StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Ask TakeProfit * Point; otherwise TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slippage, StopLossLevel, TakeProfitLevel, Buy(# MagicNumber ), MagicNumber, 0, DodgerBlue);
if(Ticket gt; 0)
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES))
Print(BUY order opened : , OrderOpenPrice());
if (SignalMail) SendMail([Signal Alert], [ Symbol() ] DoubleToStr(Ask, Digits) Open Buy);
else
Print(Error opening BUY order : , GetLastError());
if (EachTickMode) TickCheck = True;
if (! EachTickMode) BarCount = Bars;
return(0);
//Sell
if (Order == SIGNAL_SELL ((EachTickMode ! TickCheck) || (! EachTickMode (Bars ! = BarCount)))) {
if(! IsTrade) {
//Check free margin
if (AccountFreeMargin() lt; (1000 * Lots))
Print(We have no money. Free Margin = , AccountFreeMargin());
return(0);
if (UseStopLoss) StopLossLevel = Bid StopLoss * Stage; otherwise StopLossLevel = 0.0;
if (UseTakeProfit) TakeProfitLevel = Bid - TakeProfit * Point; Else TakeProfitLevel = 0.0;
Ticket = OrderSend(Symbol(), OP_SELL, Lots, Bid, Slippage, StopLossLevel, TakeProfitLevel, Sell(# MagicNumber ), MagicNumber, 0, DeepPink);
if(Ticket gt; 0)
if (OrderSelect(Ticket, SELECT_BY_TICKET, MODE_TRADES))
Printing(SELL order started : , OrderOpenPrice());
if (SignalMail) SendMail([Signal Alert], [ Symbol() ] DoubleToStr(Bid, Digits) Open Sell);
else
Printing(Error opening SELL order : , GetLastError());
if (EachTickMode) TickCheck = True;
if (! EachTickMode) BarCount = Bars;
return(0);
}
}
if (! EachTickMode) BarCount = Bars;
return(0);
}
// ------------------------------------------------------------------