Making VERY SURE an ordermodify() is Successful

 

Hi,

I'm been spending some time testing my EA with MT4 on OandA and have have come to do my first live (demo) test today and found that OandA don't allow you to send stops and TP's with the order. You have to do this afterwards.

This wasn't the case in strategy tester otherwise I would have picked it up.

How can I make absolutely sure that my ordermodify will go through? Otherwise in a worse case scenario I could enter a trade with no stoploss or TP the modify could fail and I would not know about it until a few hours later!!!

thanks!

dave.

 

you

you can attach a second ea which does just that , put`s a predefined sl and tp . You will have to attach it to every chart that you`re current ea is working on .

 

could

you could use StepStopExpert EA from Igorad, give it a serch on the forum and you will find the thread.

 

I will look at how the SL expert handles this,

I have it in a simple loop currently (part of the SELL code)

if(stopsSet != true){

modify = OrderModify(ticket,OrderOpenPrice(),Bid+stopLoss*Point,Bid-pipTarget*Point,0,Blue);

if(modify > 0){

stopsSet = true;

Print ("modify success");

}

else{ Sleep(5000);}

}

stopsSet = false;

modify = 0;

Print ("modify reset");

 

I would think the easiest way is to actually do something like:

if (OrderSend(whatever)>0) { goModifyOrder(); }

and in goModifyOrder() you would simply have a while loop that doesn't exit until OrderModify()==true.

You'll may have to RefreshRates() and such in there, but as long as you're TP and SL aren't too close to the current price, even a few pip difference shouldn't matter.

 

How can I change ea

hello plz i need help

How can I change ea If he should buy, he sells and if he should sell he buys. "Buy" to "Sell" and "Sell" to "Buy" in the EA-Editor???

plz

 

Attach the EA.

Or search for OrderSend in the EA code. You should change the OP_BUY to OP_SELL and OP_SELL to OP_BUY. Don't forget to change the Stoploss and Takepofit values too.

cha:
hello plz i need help

How can I change ea If he should buy, he sells and if he should sell he buys. "Buy" to "Sell" and "Sell" to "Buy" in the EA-Editor???

plz
Reason: