How to code? - page 239

 

Hello

I whant to find a Ma expert to do this ... can anyone help me ... ?

-open a buy or sell when price cross ma with reverse signal option

- to have a option in the menu to chose distance from the MA to take the signal like 5 pip from MA or more ( custom )

-to chose what type of MA .... olso apply to open , close , ...

-custom TP ... SL traling stop

-to close position on the next signal or at a certain distance in pips from\ under MA

- money management

- to open only 1 position at a time no more ... no hedge ...

-martingale function

-and a secondary MA (*this its optional )

- RSI to filter MA signals

maibe i'm asking for too much ... sorry for my poor english

Regards

 

not work EA

i insert Artificial intelligence EA in fxcm mt4 (Boston technology) software...

it does not work.....

but work in fxpro and alpari mt4....

i didnt know and findout what problem in this program,,,,

in domo and real in (fxcm mt4) not work.....

pls help me......

 
sluxtpr:
i insert Artificial intelligence EA in fxcm mt4 (Boston technology) software...

it does not work.....

but work in fxpro and alpari mt4....

i didnt know and findout what problem in this program,,,,

in domo and real in (fxcm mt4) not work.....

pls help me......

which artificial intelligence EA?... it may require another currency/symbol or instrument not present in fxcm

-guyver

 

Help with EA

Can a coder look at this code and tell me why it wont place trades? It works fine during backtests. It loads successfully but doesn't initialize. I have no idea where it came from but with some tweaking it has produced some decent backtests. I went to the website but it is all in chinese or something that i cannot read. Thanks in advance for all assistance !!

P.S. I had to remove url from #property link due to posting restrictions. The site is papazhoudotcom

#property copyright "Copyright ?2010, Antony, Fiona And Ken"

#property link

#define NoSignal -1

extern int EMAPeriod = 5;

extern int EMAPrice = PRICE_CLOSE;

extern int SMAPeriod = 20;

extern int SMAPrice = PRICE_CLOSE;

extern double Lots = 1;

extern int TP = 10;

extern int SL = 20;

extern int Magic = 123456;

int Signal = NoSignal;

int CloseSignal = NoSignal;

int CurrentBar = -1;

double ema1 = 0;

double sma1 = 0;

double ema2 = 0;

double sma2 = 0;

double lots;

int init()

{

lots = Lots;

return(0);

}

int deinit()

{

return(0);

}

int start()

{

if(Period() != PERIOD_M5)

{

Alert("This EA only works on M5 Period, Please adjust the current period!");

}

if(CurrentBar < Bars)

{

Signal = GetMASignal();

if(Signal != NoSignal)

{

lots = GetLots();

if(Signal == OP_SELL)

{

OpenTrade(OP_SELL, lots);

CloseSignal = OP_BUY;

}

if(Signal == OP_BUY)

{

OpenTrade(OP_BUY, lots);

CloseSignal = OP_SELL;

}

}

CurrentBar = Bars;

}

if(CloseSignal != NoSignal)

{

CloseTrades(CloseSignal);

if(!IsTradeExist(CloseSignal))

{

CloseSignal = NoSignal;

}

}

return(0);

}

//Not yet implement for auto calculate the lots by the account size

double GetLots()

{

return(Lots);

}

//Checking whether the Buy or Sell trade exist

bool IsTradeExist(int cmd)

{

int count = OrdersTotal();

for(int i=0; i<count; i++)

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

if(OrderMagicNumber() == Magic && OrderSymbol() == Symbol())

if(OrderType() == cmd)

return (true);

return(false);

}

//Close Order function

void CloseTrades(int cmd)

{

int count = OrdersTotal();

for(int i=0; i<count; i++)

if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES))

if(OrderMagicNumber() == Magic && OrderSymbol() == Symbol())

if(OrderType() == cmd)

{

if(OrderType() == OP_BUY)

OrderClose(OrderTicket(), OrderLots(), Bid, 0, Green);

if(OrderType() == OP_SELL)

OrderClose(OrderTicket(), OrderLots(), Ask, 0, Pink);

}

}

//Since some broker donot support SL & TP while sending the Order

//So use this extra function to modify the SL & TP

void ModifyTrade(int cmd, int ticket)

{

double tp, sl;

color clr;

if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))

{

if(cmd == OP_BUY)

{

tp = NormalizeDouble(OrderOpenPrice() + TP*MarketInfo(Symbol(), MODE_POINT), MarketInfo(Symbol(), MODE_DIGITS));

sl = NormalizeDouble(OrderOpenPrice() - SL*MarketInfo(Symbol(), MODE_POINT), MarketInfo(Symbol(), MODE_DIGITS));

clr = Blue;

}

if(cmd == OP_SELL)

{

tp = NormalizeDouble(OrderOpenPrice() + TP*MarketInfo(Symbol(), MODE_POINT), MarketInfo(Symbol(), MODE_DIGITS));

sl = NormalizeDouble(OrderOpenPrice() - SL*MarketInfo(Symbol(), MODE_POINT), MarketInfo(Symbol(), MODE_DIGITS));

clr = Red;

}

Print(sl);

OrderModify(OrderTicket(), OrderOpenPrice(), sl, tp, 0, clr);

}

}

//Function for opening orders

void OpenTrade(int cmd, double lots)

{

int ticket = -1;

if(cmd == OP_BUY)

ticket = OrderSend(Symbol(), OP_BUY, lots, Ask, 0, 0, 0, NULL, Magic, 0, Blue);

if(cmd == OP_SELL)

ticket = OrderSend(Symbol(), OP_SELL, lots, Bid, 0, 0, 0, NULL, Magic, 0, Red);

if(ticket > -1)

ModifyTrade(cmd, ticket);

}

//Checking 2 MA cross

int GetMASignal()

{

ema1 = iMA(Symbol(), Period(), EMAPeriod, 0, MODE_EMA, EMAPrice, 1);

sma1 = iMA(Symbol(), Period(), SMAPeriod, 0, MODE_SMMA, EMAPrice, 1);

ema2 = iMA(Symbol(), Period(), EMAPeriod, 0, MODE_EMA, EMAPrice, 2);

sma2 = iMA(Symbol(), Period(), SMAPeriod, 0, MODE_SMMA, EMAPrice, 2);

if(ema1 > sma1 && ema2 < sma2)

return(OP_BUY);

if(ema1 sma2)

return(OP_SELL);

return(NoSignal);

}

 

Update

The EA did initialize but places no trades when ma's cross

 

EA or script help please sirs

Hello gurus

please i need a EA or script that can draw a line then i will move the line with my mouse for pending order on real account... if you don't get me i can put a simple example.

 

-------------------

 

Hi, everyone...

Can anybody tell me how to get rid of automatic fibo lines on fridays to sundays, so it only shows monday through thursday?

thanks.

 
Sendra:
Hi, everyone...

Can anybody tell me how to get rid of automatic fibo lines on fridays to sundays, so it only shows monday through thursday?

thanks.

One way to do that is to check with function TimeDayOfWeek(datetime) .. you can then omit the days you dont need the fibo to display

-Guyver

 
Guyver:
One way to do that is to check with function TimeDayOfWeek(datetime) .. you can then omit the days you dont need the fibo to display -Guyver

Hi, Guyver, thanks for replying.

I tried that, but this indicator uses box as well. And doesn't matter where I put the TimeDayOfWeek, it only affects the box, not the fibo.

Reason: