MT4 Order Plugin: Trade by lines with risk based lot sizing
This plugin inspired by some great scripts / tools available on FF that make trading easier.
I made this simple tool to give me the ability to specify sl/tp for new order by using mouse (dragging line object). Input sl/tp manually is a boring task, especially for lazy trader.
It also monitor existing trade sl/tp, which means it will modify existing sl/tp and open price (for pending order) when it detected a different value between order's sl/tp and the corresponding sl/tp line object.
Other feature :
- lot size calculated automatically based on the specified risk.
- a simple popup menu that allows you to quickly close an order based on ticket number
Unlike most line object based trading tools, this program doesn't use EA for monitoring lines object every tick, or a script which uses continuous looping with certain delay. It detects mouse dragging activities (hence why it uses dll) and fire the necessary script. All script will return once its job (opening new order / modifying existing orders) finished.
- download attached zip file. this zip contains 5 scripts (EasyOrder...mq4) and one EasyOrder.dll
- extract mq4 files to scripts folder, dll file to libraries folder
- attach EasyOrder to chart where you want to open new order or modifying exisiting orders
- you should only attach / run EasyOrder.mq4 scripts. Other scripts named EasyOrder_Draw, EasyOrder_Submit, EasyOrder_XXXX is companion scripts that will be run by
dll, not to be run manually
- to prepare new order, click combo box that has text "New Order", choose Buy Stop (for example)
- program will draw three lines, each of them are sl (red), open price (gold) and tp (blue). drag them to the required position.
- click submit, read progress on alert window
- drag SL/TP line
- click Close button, you will see a popup showing the list of order's ticket
- Right click on any part of the order window, on the popup menu, choose remove.
Let me know your experience with this baby
- Add notification if program failed to get market watch handle
- When user drag SL/TP line, lines of closed order will be deleted
- Add new popup menu item to refresh lines (dll)
- Risk lot is editable, you can type any lot size (dll)
- Files are listed separately
- Put latest update (March 16, 2011) on the front page
- Update for Build 602
- Remove unused Price/SL/TP lines after script is executed.
- Add confirmation dialog
- To make sure all Easy Order script are updated properly, make sure that you remove all previous EasyOrder_XXX.xxx in script folders before installing this update.
- Add option for removing confirmation dialog
- Add option for specifying number of orders
- See http://www.forexfactory.com/showthre...31#post8221631
- Update EasyOrder_Draw.ex4. Now the order related lines are thinner and are already selected, thus you don't need to double click to move them.
- Add EasyOrderInd.ex4 indicator to automatically adjust TP line based on a defined Risk / Reward ratio
- Update EasyOrderInd.ex4 to refresh TP line when price changed
It seems that everybody is writing these visual order managers now.
hi hanover, thank you for your comment
I have been looking for this exact script. Really, this is great. I love how it calculates risk size based on SL. One less thing that i have to do. Thanks!
What does it mean when it says "invalid lot size"?
unfortunately that did not help. I tried to set it and close it but I still get that error.
i will try to solve that issue by adding logging function.
Thanks for the great tool!
Initially it worked, but now each time it returns this error:
Could you please also explain how the lot size is calculated? As I see it should depend on the stop/loss level specified. What does the risk field (1.0, 1.1 etc.) mean?
Order lines not deleted
Thank you sharing this create tool. I have been working with it since yesterday and it saves me a lot of time. There is only thing that I would like to ask to have a look at. After the order closed by SL or TP the lines are not deleted. Can you please see if you could fix this?
Thanks in advance!
Nice work again!
Ok, so I already have a pre-defined way of entering trades...but I LOVE using this for moving my SL/TP's on the PENDING Orders I set in advance..instead of clunkily typing in each TP/SL for each order I can just drag and drop my pending order script with generic 20/20 SL/TP and then with your new script I can move the SL/TP easily. Also, I have always hated using the hot keys to drop the CLOSE order script onto the chart...now I just click the Close button on your awesome creation.
WAY TO GO!!
hi pilot and piet,
finally i got positive response
btw, have you ever got error (invalid lot size, submit return error?) do you notice significant increase of cpu / memory consumption? your feedback is really appreciated.
@piet: currently there is no function to automatically delete lines belong to closed order. i'll add a new item in popup menu to update sl/tp lines
I love the idea and was going to pay someone to make it for me. So you saved me some time and money. Thank you!
Please let me know if you ever get to fixing that logging issue.
I had the error 'invalid lotsize' once, but couldn't reproduce it.
Thanks for looking into the line deletion function!
files updated on post #1.
@piet: to refresh lines including deleting lines that corresponding to closed order, simply drag one of the remaining lines in the chart
Thank you for the update. I am testing it and will give my feedback.
Is there a way to change the risk percentages that are provided in the drop down box? Sorry if this is a newbie question but I didn't see it in the code.
Please update your dll file. If you have run EasyOrder script, you need to close MT4 to release dll file locking by MT4, and then replacing it with updated dll on post #1.
I have change drop down box style such that the risk is editable. Now you can type, for example 0.7 instead of having to choose 1.0 - 2.0 from the list.
I truly love this contribution. This is so practical. Thank you very much.
I'm sorry I missed your question. Risk field means percentage of ratio of money risked to account balance. It depend on the distance between open price and sl. Currently it is assumed that your account currency is USD
Risk calculation for XXX/USD:
risk ($) = (open price - sl) x lot x 100,000
risk (%) = 100 x risk ($) / account balance
notes: sl means the price level (ie: 1.38275) not in pips distance
Risk calculation (for USD/XXX):
risk ($) = (open price - sl) x lot x 100,000 / sl
risk (%) = 100 x risk ($) / account balance
Risk calculation (for YYY/XXX):
Imo, it is impossible to accurately predict risk in advanced for crosses that are not paired vs USD. The following calc is approximation:
- There exists USD/XXX, such as USD/JPY
risk ($) = (open price - sl) x lot x 100,000 / (USD/XXX)
- There exists XXX/USD, such as GBP/USD
risk ($) = (open price - sl) x lot x 100,000 x (XXX/USD)
What about "invalid lot size" error? Do you still see it?
© Forex Factory