AI "Artificial Intelligent" EA - page 2

 

hi users,


i used artificaial intelligent ea in fxpro metatradersoftware.. it works very fine. and also metattrader alpari software this software.


but in fxcm metatrader software didnt take that means it didnt work...


anybody know....why this EA AI particularlly not work in fxcm metatrader.....pls give the solution for me.....

i put here this code here....

extern int TakeProfit=56;
extern double StopLoss = 125;
extern int x1 = 135;
extern int x2 = 127;
extern int x3 = 16;
extern int x4 = 93;
extern double lots = 0.1;
extern int MagicNumber = 524178;
static int prevtime = 0;

double sl, xecn, TakeProfitX;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
xecn=1;
if(Digits==5){xecn=10;}
if(Digits==3){xecn=10;}

TakeProfitX=TakeProfit*xecn;
sl=StopLoss*xecn;

if(Time[0] == prevtime)
return(0);
prevtime = Time[0];
int spread = 3;
//----
if(IsTradeAllowed())
{
RefreshRates();
spread = MarketInfo(Symbol(), MODE_SPREAD);
}
else
{
prevtime = Time[1];
return(0);
}
int ticket = -1;
// check for opened position
int total = OrdersTotal();
//----
for(int i = 0; i < total; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
// check for symbol & magic number
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
int prevticket = OrderTicket();
// long position is opened
if(OrderType() == OP_BUY)
{
// check profit
if(Bid > (OrderStopLoss() + (sl * 2 + spread) * Point))
{
if(perceptron() < 0)
{ // reverse
ticket = OrderSend(Symbol(), OP_SELL, lots * 2, Bid, 3,
Ask + sl * Point, Ask-TakeProfitX*Point, "AI", MagicNumber, 0, Red);
Sleep(30000);
//----
if(ticket < 0)
prevtime = Time[1];
else
OrderCloseBy(ticket, prevticket, Blue);
}
else
{ // trailing stop
if(!OrderModify(OrderTicket(), OrderOpenPrice(), Bid - sl * Point,
OrderTakeProfit(), 0, Blue))
{
Sleep(30000);
prevtime = Time[1];
}
}
}
// short position is opened
}
else
{
// check profit
if(Ask < (OrderStopLoss() - (sl * 2 + spread) * Point))
{
if(perceptron() > 0)
{ // reverse
ticket = OrderSend(Symbol(), OP_BUY, lots * 2, Ask, 3,
Bid - sl * Point, Bid+TakeProfitX*Point, "AI", MagicNumber, 0, Blue);
Sleep(30000);
//----
if(ticket < 0)
prevtime = Time[1];
else
OrderCloseBy(ticket, prevticket, Blue);
}
else
{ // trailing stop
if(!OrderModify(OrderTicket(), OrderOpenPrice(), Ask + sl * Point,
OrderTakeProfit(), 0, Blue))
{
Sleep(30000);
prevtime = Time[1];
}
}
}
}
// exit
return(0);
}
}
// check for long or short position possibility
if(perceptron() > 0)
{ //long
ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Bid - sl * Point, Bid+TakeProfitX*Point, "AI",
MagicNumber, 0, Blue);
//----
if(ticket < 0)
{
Sleep(30000);
prevtime = Time[1];
}
}
else
{ // short
ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Ask + sl * Point, Ask-TakeProfitX*Point, "AI",
MagicNumber, 0, Red);
if(ticket < 0)
{
Sleep(30000);
prevtime = Time[1];
}
}
//--- exit
return(0);
}
//+------------------------------------------------------------------+
//| The PERCEPTRON - a perceiving and recognizing function |
//+------------------------------------------------------------------+
double perceptron()
{
double w1 = x1 - 100;
double w2 = x2 - 100;
double w3 = x3 - 100;
double w4 = x4 - 100;
double a1 = iAC(Symbol(), 0, 0);
double a2 = iAC(Symbol(), 0, 7);
double a3 = iAC(Symbol(), 0, 14);
double a4 = iAC(Symbol(), 0, 21);
return(w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4);
}
//+------------------------------------------------------------------+


 
sluxtpr:

i put here this code here....

Please use the SRC button for short code snippets or attach the mq4/mqh file for large blocks of code.


 
Could it be a digits problem? Do the brokers have the same number of decimal places after the point? If not try changing the take and stop values by multiplying by 10.
 
gordon:

Please use the SRC button for short code snippets or attach the mq4/mqh file for large blocks of code.



thanks for your reply...where is ther ur put image file..... in any metatrader editor.....

otherwise pls change directly in my program and sent to my mail address of sluxtpratgmialdotcom.

 
Ruptor:
Could it be a digits problem? Do the brokers have the same number of decimal places after the point? If not try changing the take and stop values by multiplying by 10.

thanks for your rply my dear Ruptor.

have u explained in detail format....i cant understand that what u say come to me......


anyway...try to me....give full solution....or say the values to put these programme.........

 

Could also be the server doesn't like TP/SL with OrderSend. When the function fails print out GetLastError() Try OrderSend with zero TP/SL followed by OrderModify

Could be a digits problem, TP, SL, AND SLIPPAGE

if(Digits==5){xecn=10;}
if(Digits==3){xecn=10;}
//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init(){
    if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
 
i put here this code here....

extern int TakeProfit=56;
extern double StopLoss = 125;
extern int x1 = 135;
extern int x2 = 127;
extern int x3 = 16;
extern int x4 = 93;
extern double lots = 0.1;
extern int MagicNumber = 524178;
static int prevtime = 0;

double sl, xecn, TakeProfitX;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
xecn=1;
if(Digits==5){xecn=10;}
if(Digits==3){xecn=10;}

TakeProfitX=TakeProfit*xecn;
sl=StopLoss*xecn;

if(Time[0] == prevtime)
return(0);
prevtime = Time[0];
int spread = 3;
//----
if(IsTradeAllowed())
{
RefreshRates();
spread = MarketInfo(Symbol(), MODE_SPREAD);
}
else
{
prevtime = Time[1];
return(0);
}
int ticket = -1;
// check for opened position
int total = OrdersTotal();
//----
for(int i = 0; i < total; i++)
{
OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
// check for symbol & magic number
if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
{
int prevticket = OrderTicket();
// long position is opened
if(OrderType() == OP_BUY)
{
// check profit
if(Bid > (OrderStopLoss() + (sl * 2 + spread) * Point))
{
if(perceptron() < 0)
{ // reverse
ticket = OrderSend(Symbol(), OP_SELL, lots * 2, Bid, 3,
Ask + sl * Point, Ask-TakeProfitX*Point, "AI", MagicNumber, 0, Red);
Sleep(30000);
//----
if(ticket < 0)
prevtime = Time[1];
else
OrderCloseBy(ticket, prevticket, Blue);
}
else
{ // trailing stop
if(!OrderModify(OrderTicket(), OrderOpenPrice(), Bid - sl * Point,
OrderTakeProfit(), 0, Blue))
{
Sleep(30000);
prevtime = Time[1];
}
}
}
// short position is opened
}
else
{
// check profit
if(Ask < (OrderStopLoss() - (sl * 2 + spread) * Point))
{
if(perceptron() > 0)
{ // reverse
ticket = OrderSend(Symbol(), OP_BUY, lots * 2, Ask, 3,
Bid - sl * Point, Bid+TakeProfitX*Point, "AI", MagicNumber, 0, Blue);
Sleep(30000);
//----
if(ticket < 0)
prevtime = Time[1];
else
OrderCloseBy(ticket, prevticket, Blue);
}
else
{ // trailing stop
if(!OrderModify(OrderTicket(), OrderOpenPrice(), Ask + sl * Point,
OrderTakeProfit(), 0, Blue))
{
Sleep(30000);
prevtime = Time[1];
}
}
}
}
// exit
return(0);
}
}
// check for long or short position possibility
if(perceptron() > 0)
{ //long
ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 3, Bid - sl * Point, Bid+TakeProfitX*Point, "AI",
MagicNumber, 0, Blue);
//----
if(ticket < 0)
{
Sleep(30000);
prevtime = Time[1];
}
}
else
{ // short
ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, 3, Ask + sl * Point, Ask-TakeProfitX*Point, "AI",
MagicNumber, 0, Red);
if(ticket < 0)
{
Sleep(30000);
prevtime = Time[1];
}
}
//--- exit
return(0);
}
//+------------------------------------------------------------------+
//| The PERCEPTRON - a perceiving and recognizing function |
//+------------------------------------------------------------------+
double perceptron()
{
double w1 = x1 - 100;
double w2 = x2 - 100;
double w3 = x3 - 100;
double w4 = x4 - 100;
double a1 = iAC(Symbol(), 0, 0);
double a2 = iAC(Symbol(), 0, 7);
double a3 = iAC(Symbol(), 0, 14);
double a4 = iAC(Symbol(), 0, 21);
return(w1 * a1 + w2 * a2 + w3 * a3 + w4 * a4);
}
//+------------------------------------------------------------------+


hi users,


i used artificaial intelligent ea in fxpro metatrader software.. it works very fine. and also Work in Alpari Meta Trader software.


But in fxcm metatrader software didnt take this EA. The above code didnt work in FXCM MetaTrader Platform.....

If anybody know....why this EA AI particularlly not work in fxcm metatrader.....pls give the solution for me.....

If Found solution, pls give full code format. Or what, which line insert in my program.....

 
sluxtpr:

But in fxcm metatrader software didnt take this EA. The above code didnt work in FXCM MetaTrader Platform.....

AFAIK, FXCM's bridge requires sending orders with no TP/SL. There's lots of info in the forum for how to resolve this issue (for example -> https://www.mql5.com/en/forum/122928). I also suggest u visit their forum for more info -> http://forexforums.dailyfx.com/mt4/.

 
gordon:
AFAIK, FXCM's bridge requires sending orders with no TP/SL.

Which I also said. I also mentioned the slippage.

If Found solution, pls give full code format. Or what, which line insert in my program.....
No slaves here, either learn to code it or pay somebody.
 
WHRoeder:

Which I also said. I also mentioned the slippage.

No slaves here, either learn to code it or pay somebody.

ok.. WHRoeder...


as like your command....i add slippage.... it is working now.... thanking you....