• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 11:18am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 11:18am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Print Thread

Similar Threads

How to calculate forex position sizing / lot sizing 17 replies

MT4 plugin for simultaneous trade on friend's account? 1 reply

BUY run profit 1 lot, SELL LIMIT 2 LOT down again n BUY 1 lot - EA Reqd 5 replies

Help with Lot sizing 3 replies

IBFX Lot sizing 10 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 211
Attachments: MT4 Order Plugin: Trade by lines with risk based lot sizing
Exit Attachments
Tags: MT4 Order Plugin: Trade by lines with risk based lot sizing
Cancel

MT4 Order Plugin: Trade by lines with risk based lot sizing

  • Last Post
  •  
  • Page 1 23456 65
  • Page 1 234 65
  •  
  • Post #1
  • Quote
  • First Post: Edited May 1, 2015 9:31am Feb 22, 2011 11:55am | Edited May 1, 2015 9:31am
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
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.

To use:
- 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

New Order
- 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

Modify SL/TP
- drag SL/TP line

Close Order
- click Close button, you will see a popup showing the list of order's ticket

Remove Window
- Right click on any part of the order window, on the popup menu, choose remove.

Let me know your experience with this baby

Update
2011.02.24:
- Add notification if program failed to get market watch handle
- When user drag SL/TP line, lines of closed order will be deleted
2011.02.25:
- Add new popup menu item to refresh lines (dll)
- Risk lot is editable, you can type any lot size (dll)
- Files are listed separately
2011.07.10:
- Put latest update (March 16, 2011) on the front page
2014.02.07
- Update for Build 602
2015.04.8
- 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.
2015.04.22
- Add option for removing confirmation dialog
- Add option for specifying number of orders
- See http://www.forexfactory.com/showthre...31#post8221631
2015.04.23
- 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
2015.05.01
- Update EasyOrderInd.ex4 to refresh TP line when price changed
Attached Image (click to enlarge)
Click to Enlarge

Name: EasyOrderConfirmation.png
Size: 34 KB
Attached Image
Attached File(s)
File Type: zip EasyOrder_2015.04.08.zip   37 KB | 15,928 downloads | Uploaded Apr 7, 2015 2:55pm
File Type: zip EasyOrder_2015.04.22.zip   29 KB | 17,379 downloads | Uploaded Apr 22, 2015 9:23am
File Type: ex4 EasyOrder_Draw.ex4   8 KB | 10,343 downloads | Uploaded Apr 23, 2015 11:53am
File Type: ex4 EasyOrderInd.ex4   8 KB | 10,889 downloads | Uploaded May 1, 2015 9:31am
  • Post #2
  • Quote
  • Feb 22, 2011 8:59pm Feb 22, 2011 8:59pm
  •  hanover
  • Joined Sep 2006 | Status: ... | 8,092 Posts
Quoting sangmane
Disliked
Let me know your experience with this baby
Ignored
Nice work.

It seems that everybody is writing these visual order managers now.
 
 
  • Post #3
  • Quote
  • Feb 23, 2011 1:26pm Feb 23, 2011 1:26pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
hi hanover, thank you for your comment
 
 
  • Post #4
  • Quote
  • Edited 1:52pm Feb 23, 2011 1:29pm | Edited 1:52pm
  •  newark18
  • | Joined Sep 2010 | Status: Member | 371 Posts
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"?
 
 
  • Post #5
  • Quote
  • Feb 23, 2011 1:57pm Feb 23, 2011 1:57pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
hi newark,

that's an imperfect code in my dll. you got that message if market watch window is floating. try put market watch such that it sit on navigator window. you don't have to keep it open. once market watch sit on navigator, you can close it.

let me know if it solve your problems
Attached Image (click to enlarge)
Click to Enlarge

Name: market watch.gif
Size: 62 KB
 
 
  • Post #6
  • Quote
  • Feb 23, 2011 2:33pm Feb 23, 2011 2:33pm
  •  newark18
  • | Joined Sep 2010 | Status: Member | 371 Posts
unfortunately that did not help. I tried to set it and close it but I still get that error.
 
 
  • Post #7
  • Quote
  • Feb 23, 2011 2:38pm Feb 23, 2011 2:38pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
i will try to solve that issue by adding logging function.
 
 
  • Post #8
  • Quote
  • Feb 24, 2011 3:54am Feb 24, 2011 3:54am
  •  Natali
  • | Joined Jan 2011 | Status: Member | 8 Posts
Hi sangmane,

Thanks for the great tool!
Initially it worked, but now each time it returns this error:
Attached Image

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?
 
 
  • Post #9
  • Quote
  • Feb 24, 2011 10:56am Feb 24, 2011 10:56am
  •  Piet411
  • | Joined Mar 2010 | Status: Member | 8 Posts
Hi Sangmane,

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!

Regards,
Piet
 
 
  • Post #10
  • Quote
  • Edited 11:22am Feb 24, 2011 11:17am | Edited 11:22am
  •  pilotui
  • | Joined Jul 2009 | Status: Disabled Vet | 734 Posts
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!!
 
1
  • Post #11
  • Quote
  • Feb 24, 2011 11:55am Feb 24, 2011 11:55am
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
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
 
 
  • Post #12
  • Quote
  • Feb 24, 2011 12:18pm Feb 24, 2011 12:18pm
  •  newark18
  • | Joined Sep 2010 | Status: Member | 371 Posts
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.
 
 
  • Post #13
  • Quote
  • Feb 24, 2011 12:52pm Feb 24, 2011 12:52pm
  •  Piet411
  • | Joined Mar 2010 | Status: Member | 8 Posts
Hi Sangemane,

I had the error 'invalid lotsize' once, but couldn't reproduce it.

Thanks for looking into the line deletion function!

Regards,
Piet
 
 
  • Post #14
  • Quote
  • Feb 24, 2011 2:03pm Feb 24, 2011 2:03pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
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
 
 
  • Post #15
  • Quote
  • Feb 24, 2011 11:00pm Feb 24, 2011 11:00pm
  •  Piet411
  • | Joined Mar 2010 | Status: Member | 8 Posts
Hi Sangmane,

Thank you for the update. I am testing it and will give my feedback.

Regards,
Piet
 
 
  • Post #16
  • Quote
  • Feb 24, 2011 11:10pm Feb 24, 2011 11:10pm
  •  newark18
  • | Joined Sep 2010 | Status: Member | 371 Posts
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.
 
 
  • Post #17
  • Quote
  • Feb 24, 2011 11:39pm Feb 24, 2011 11:39pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
Quoting newark18
Disliked
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.
Ignored
Risk percentage list is coded in dll, not in mq4.

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.
 
 
  • Post #18
  • Quote
  • Feb 24, 2011 11:44pm Feb 24, 2011 11:44pm
  •  newark18
  • | Joined Sep 2010 | Status: Member | 371 Posts
Sangmane,

I truly love this contribution. This is so practical. Thank you very much.
 
 
  • Post #19
  • Quote
  • Feb 24, 2011 11:55pm Feb 24, 2011 11:55pm
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
Quoting Natali
Disliked
Hi sangmane,

Thanks for the great tool!
Initially it worked, but now each time it returns this error:
Attachment 647917
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?
Ignored
Hi natali,

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)
 
 
  • Post #20
  • Quote
  • Feb 25, 2011 12:05am Feb 25, 2011 12:05am
  •  sangmane
  • Joined Apr 2009 | Status: MT4 Programmer | 758 Posts
Quoting newark18
Disliked
Sangmane,

I truly love this contribution. This is so practical. Thank you very much.
Ignored
Glad to know that
What about "invalid lot size" error? Do you still see it?
 
 
  • Platform Tech
  • /
  • MT4 Order Plugin: Trade by lines with risk based lot sizing
  • Reply to Thread
    • Page 1 23456 65
    • Page 1 234 65
1 trader viewing now
  • More
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2023