an inverse trade :buy order to sell order

 

I  need to change the coding of an expert advisor in mt4 to do the following:

at present coding is

when all condition are  buy , I need to change this to a sell

I HAVE TRIED CHANGING buyPrice to sellPrice but get error 130.

please advise?

roddi

 
Rod Matcham:

I  need to change the coding of an expert advisor in mt4 to do the following:

at present coding is

when all condition are  buy , I need to change this to a sell

I HAVE TRIED CHANGING buyPrice to sellPrice but get error 130.

please advise?

roddi

The solution can be found if you just add the OrderSend buy and Sell lines in the expert here by pressing Alt + S. Otherwise, it may be like I can go to the pharmacy and buy a medicine. Good luck with.

 
thanks 
 
can u do the changes for me if I send the mql5 ext file?
 
Rod Matcham:
can u do the changes for me if I send the mql5 ext file?

You 'Sell' at Bid

You 'Buy' at ask

conclusion simplified;

//BUY
OrderSend(Symbol(),OP_BUY,0.01,Ask,5,Bid-StopLoss*Point,Ask+TakeProfit*Point,NULL,1234,0,Green);

//Sell
OrderSend(Symbol(),OP_SELL,0.01,Bid,5,Ask+StopLoss*Point,Bid-TakeProfit*Point,NULL,1234,0,Red);
 
Don't expect your idea to work though. If always buying is a looser, is always selling a winner?
 
Kenneth Parling:

You 'Sell' at Bid

You 'Buy' at ask

conclusion simplified;

thanks so much
 
Rod Matcham:
thanks so much

you're welcome

Reason: