pending orders... any suggestions?

 

i have little experience with mql4 coding, but i had an idea...


i want to program a code that will open 2 pending orders, one buy and one sell...


the buy will open 15 points above where the pending order trade was placed, and the sell will open 15 points below.


i would also like to add a solid stop loss, along with a dynamic stop loss, ie. trailing stop.


i just wanna keep this code simple, i know the basic language, and i think that's all i need, thx in advance


-dan

 
Dan, please contact me at: mail at sxTed dot com
 
sxTed:
Dan, please contact me at: mail at sxTed dot com

thanks for the help, but i don't need a complex expert advisor, just a simple script that will execute a pending order with specified parameters, if anyone else can assist, i'd apprecaite it, thanks guys


-dan

 
deymer:

thanks for the help, but i don't need a complex expert advisor, just a simple script that will execute a pending order with specified parameters, if anyone else can assist, i'd apprecaite it, thanks guys


-dan

Hi Dan


MT4 comes with some scripts that are useful to copy and modify. For yor purpose, look at send_pending.mq4, which sends just one pending order.

You would have to modify it to set the stop-loss level based on a distance from the current price. To send two orders just run it twice.

You may also want to input the order parameters (e.g. fixed stop-loss) manually. This can be done by replacing #property show_confirm with #property show_inputs and defining your inputs with extern definitions.


For the trailing stop, the price needs to be monitored continuously. I know of two options: (1) use the server-based trailing stop, which is available only by manually setting it from the terminal after one of the pending orders is executed or (2) running an EA to monitor the price and move the stop-loss on the open trade.


It occurs to me that if you want to do no more than what you say, then maybe the best way is to use the regular Order window.


Cheers

Jellybean

Reason: