MM && Risk - riskBased OrderSend script for Empty4

Post Reply
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

MM && Risk - riskBased OrderSend script for Empty4

Post by fxdaytrader »

Attached you will find "one more" mm script.

I think the inputs are self-explanatory.
The script sends one buy-order and calculates the lots by risk+sl (mode 1), sl by risk+lots (mode 2), lots by risk+sl given by atr (mode 3) and the lots by risk+sl, where the user types the sl (in pips or price, depends on the setting) in an input box.

To use the input-box feature, you have to install one dll, pls. see .zip-file contents for further instructions, copyright hints (dll by fx1.net, ordersend routines by steve hopwood) and so on (there you will finde the dll also).

Ok, you do not have to try the script on demo first, because there are some safety features implemented: DEMOmode=true. The script does not send an order. You have to set it to "false" to let the script do its work.

The inputbox for external variables will popup each time you call the script, to change that do this:
change that line in the code: #property show_inputs
to: //#property show_inputs

Further there will be a messagebox before sending the trade - you have to confirm the action.

to use the script for sell-orders also, you have to change the following external variable:
extern int type=OP_BUY; //OrderType(), OP_BUY or OP_SELL

If you have a use for the script, open it in the editor, change the parameters to suit your needs and save it under the name you want. After that you may assign an hotkey to the script and everytime you want to open an order, you will not press "f9" for the orderwindow, but the hotkey to call the script.

testers welcome, pls. report bugs, etc. pp. ;)
BUY.RiskBased OrderSend Script v1.zip
BUY.RiskBased OrderSend Script v1.1.mq4
You do not have the required permissions to view the files attached to this post.
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: MM && Risk - riskBased OrderSend script for Empty4

Post by fxdaytrader »

attached a new version, it should consider the profitable open positions (e.g. buy: SL > orderopenprice) and add that profit to the acc.balance.

some issues patched, e.g.: gold has 2 decimal points behind the comma, but mql seems to deal with it with 3 digits. Because you do not know the symbols name at your broker, I tried it another way (for details, please look at the code, or at this topic here). If it works with every broker - i donnot know :)

forgot one detail ...
You do not have the required permissions to view the files attached to this post.
User avatar
themaxx
Trader
Posts: 71
Joined: Thu May 24, 2012 9:57 am

Re: MM && Risk - riskBased OrderSend script for Empty4

Post by themaxx »

Thank you this is very useful
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: MM && Risk - riskBased OrderSend script for Empty4

Post by dietcoke »

Nice work. I've been working on something similar for Forex Robot.

What's the point behind Tickvaluereliable?
User avatar
fxdaytrader
Trader
Posts: 190
Joined: Sun Jun 10, 2012 7:03 am
Location: Poon-Town (germany, se-asia, se-europe) ...

Re: MM && Risk - riskBased OrderSend script for Empty4

Post by fxdaytrader »

i quote from the sourcecode -
fix tickvalue for extremely rare occasion when a change in ticksize leads to a change in tickvalue, source: http://forum.mql4.com/29781

I am not sure whether it is negligible or not, but maybe it is not wrong to implement it.
Post Reply

Return to “Trading Psychology & Money Management”