Straddle Script?

 

Hi members,

I am new to this so please bear with me.

I want a buy stop and sell stop order to be initiated simultaneously at my command with the following parameters.

Buy Stop Entry = Market + 15 pips

Stop Loss = Entry - 10 pips

Take Profit = Entry + 25 pips

Sell Stop Entry = Market - 15 pips

Stop Loss = Entry + 10 pips

Take Profit = Entry - 25

Is this possible? and is there anybody that would be kind enough to help me write it or do it for me as i have no idea where to start or once it is written how to apply it to the platform

Please help!!

Alan (skyblue)

 

"I want a buy stop and sell stop order to be initiated simultaneously at my command with the following parameters."


no, serial/sequential/one-at-a-time market order placement mechanism between client/server. much time may/could/can pass before another order allowed.



https://www.mql5.com/en/search?utm_campaign=MQL4.community


but... If you have two opposite orders for a certain symbol, you can close them simultaneously, one by another, using the function OrderCloseBy(). You will save one spread if you perform such an operation.

 
//set the size of trade here
double Lots = 0.1;
double PBid;
double PAsk;
int Ticket;
 
int init()
{
   PBid = MarketInfo(Symbol(), MODE_BID);
   PAsk = MarketInfo(Symbol(), MODE_ASK);
}
 
int start()
{
 
if (Ask > PAsk+15*Point) 
{
   Ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,3,Ask-10*Point,Ask+25*Point,NULL,0,0,Green);
}
 
if (Bid < PBid-15*Point) 
{
   Ticket = OrderSend(Symbol(),OP_SELL,Lots,Bid,3,Ask+10*Point,Ask-25*Point,NULL,0,0,Red);
}
 
return;
}
 

Any idea how one could get this script to cancel all trades when a take profit executes and have it restart automatically?
 

Any idea how one could get this script to cancel all trades when a take profit executes and have it restart automatically?

 
Look into OrderDelete, Freeze_Level, Continuous Loops.