Download MetaTrader 5

Question about setting and trading using stop loss orders.

To add comments, please log in or register
snackerdog Vogl
snackerdog Vogl 2012.07.24 00:46 

I am fairly new to MT5 platform programming.  I am an experienced C coder.  I am seeking sample code for an expert trading system using "Stop Loss" orders.  I would like to find something along the lines of the "Semaphore Trading" example I found in the MQL5 Literature. What I envision should be able to place initial orders and cancel and replace orders on previous placed Stop Loss orders and have provisions to cancel pending orders. Placing and tracking orders. When the Expert is stopped it should be able to resume by locating any previously placed stops and adding these to the tracking system. At any time there should be only one stop at any price level either Short or Long.  Should be able to handle stops on both sides of the trade simultaneously.  ie short and long.  It might also track and handle any open positions or deals by preventing more stops being placed in that direction. The mechanics of the trading system are not important and I will supply those. Would like to be able to call a function something like { void setstop(int direction, double price); }  Where direction would be + for long - for short and 0 for cancel.  This should make it simple to test trading systems with an indicator using a single line.

If I cannot obtain a good start I am thinking about creating my own system that will detect when prices cross through the threshhold and place market orders.  But I feel that placing and adjusting stops might be preferable to market orders especially in fast market conditions.  I'm not certain about this however and would also like to hear your thoughts on the process.  Whether it is any advantage to use Stop Loss orders to trade on the MT5 Brokers server or to just place Market orders.  Adjusting Stops real time on the Brokers server or monitoring it on the local machine and placing Market Orders.   Which do you think would be preferable and why?

I look forward to your comments and suggestions.



To add comments, please log in or register