Help for my First EA

 

Hello,

I have make a simple EA for the First Time.

I used a ADX 14 Indikator on 5 Minutes Timescale. (chart = Candlestick).

I have implemented a Short and Buy Signal.

I test before i opened a Order the Active Orders,

If i want to Buy i check the Sell orders and close this.

Can anyone Help me to find the fault in my EA ?

Thanks

Files:
adxorene.mq4  7 kb
 

R

Two problems on first read thru

Little problem - MAGIC = 007, dont do this, MagicNumber is an integer, so do it this way so you can change it from outside

extern int MagicNumber=7;

Big Problem

You have confused MagicNumber with TicketNumber

See

OrderTicket( )

so your OrderClose wont work :(

Good Luck

-BB-

 

Hello,

I have found a Problem with the Variables Declarations in the Sell Order with Ticket and TicketBuy...

I make an if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
and later this :

OrderClose(OrderTicket(),OrderLots(),Bid,CLR_NONE );

Order close needs a Ticketnumber and in the OrderSelect i get the OrderTicket() Ticketnumber.

Is this Correct ?

Thanks for your Help .

Files:
adxgrene.mq4  7 kb
Reason: