Place orders quickly

 
I bought a trading system where I need to be able to place a market order quickly. How would I do that, script? I would want to place a market order, buy or sell, with a stop loss of 15, trailing stop of 15 and take profit of 100, for the symbol of the chart.

Thanks in advance,

Ed
 
yarns90401:
I bought a trading system where I need to be able to place a market order quickly. How would I do that, script? I would want to place a market order, buy or sell, with a stop loss of 15, trailing stop of 15 and take profit of 100, for the symbol of the chart.

A script that is launched by a hot key should do.
 
Thank you. How do you launch a script by hot key? Suppose I have 3 charts open for different pairs, how will it know which one to operate on?

Thanks again,

Ed
 
yarns90401:
Thank you. How do you launch a script by hot key?

Navigator context menu (by right click on the script) -> Set hotkey.


Suppose I have 3 charts open for different pairs, how will it know which one to operate on?

It won't. The script will always run on the active chart I believe.

However it's quite possible to open a position with any available symbol regardless to the current chart symbol by using real time market data provided by MarketInfo() functionality.

You might want to have three separate scripts with different symbol, position size, stoploss and takeprofit levels, etc. hardcoded in them for the sake of quickest response that are assigned to corresponding hotkeys.

Trailing stop is another issue here though and it requires a special approach.
 
yarns90401:
Thank you. How do you launch a script by hot key? Suppose I have 3 charts open for different pairs, how will it know which one to operate on?

Thanks again,

Ed
"fast" can be seen as SLOW due to Client Terminal only having one thread for issuing orders to trade server.
Having three hotkeys mapped to three hardcoded modules is perhaps nice idea but hitting three hotkeys fast will result in [at least] two failures to issue market order.
It could take varying time before this trading thread becomes free and you must be aware of [and check in code for] this...
Suggest looking at docs to determine when code will have reasonable chance success when issuing market order https://docs.mql4.com/check
Please correct me if in error - then I learn too ;-)

forgot to mention: https://docs.mql4.com/trading gives overview/background to what saying above.
Reason: