MPTM's new home

MPTM's new home

MPTM's new home

Postby SteveHopwood » Sun Nov 20, 2011 10:15 pm

Welcome to MPTM. MPTM was the first EA I offered up for use by fellow traders. I am astonished to find it being used all over the world. I originally made it available at Forex Factory, but the dimwit that runs the forum has pissed me off, so I have moved it here.

For those of you who do not know what mtpm is: I have written/am writing a multi-purpose trade managing EA. At heart, this is about manipulating stop losses and take profits of trades already open. The only way to get a feel for what the ea does is to read the user guide and try the ea on demo, using what you glean from the guide to help you select your input values.

I posted the first version of mptm back in the summer of 2008. Since then, it has grown and grown. I hope you find it useful.

Disclaimer
I coded a lot of functions into the ea in response to requests from users to do so. I have not used many of them and have forgotten how they work or what they do. Do not bother asking me questions such as, "What do I do to......", or, "How do I....." The chances are that I do not know the answer. In any case, I shall ignore the question. Read the user guide and experiment on demo to find a solution. Feel free to ask questions of other traders here. Someone might know the answer and be prepared to supply an answer; just don't expect one from me. Don't waste time sending me pm's about problems either; I shall ignore them. Well, I shall ignore them on a good day. On a bad day, just remember that I am a power-crazed admin. :lol:

Doing thingies for yourselves
Whenever using an ea, script or indicator, it helps enormously if we traders can customise the inputs to suit ourselves. "How to edit a script code" describes how to do this; the lessons learned are equally applicable to any Empty4 software. Read the pdf and learn how to make these basic edits for yourselves; it is both useful and fun to be able to do so. Go on, go for it. You know you can. You know you want to........................ :lol:

A couple of useful pending order scripts presented by DragosDanescu: DragosDanescu @ MPTM's new home

Updates not included in the user guide
Trade management hours. This feature works the same way as does trading hours in my trading EA's, so find one of the umpteen copies of the Shell user guide for details. The reason for this addition is to be found at SteveHopwood @ MPTM's new home

Pips/points conversion
All pips entries should be made in proper pips, not the dreadful points thingy foisted upon us by the market-maker crims determined to confuse us and so separate us from our deposits.

For this, all our thanks go to Lifesys - Paul. Paul has adapted all the previous pips/point stuff that emerged a while ago. He has also adapted the part-close code to simply close Close_LotsFract percent of a trade at each closure point, so no need any more to specify Close_Lots and Preserve_Lots. Thanks Paul. You are a star.

For the coders
There are two multi-purpose functions to deal with the usual OrderModify(), OrderDelete() and OrderClose() functions:
  • bool ModifyOrder(int ticket, double price, double stop, double take, datetime expiration, color col, string function, string reason)
  • bool CloseOrder(int ticket, string function, double CloseLots, string reason)

There is a single error reporting function - void ReportError(string function, string message) - that is called from within ModifyOrder() and CloseOrder(). So, instead of all those OrderClose(list of params) calls with all those error call functions when something goes wrong, we have a simple one line call.

For example, CloseBasketTrades() has this call:
Code: [Select all]
 Please Login or Register to see this content
<

__FUNCTION__ is a useful thingy that I found. It is two underscores on either side of the word. It holds the name of the function from which CloseOrder() is called. 'ocm' is the 'reason' parameter and stands for 'Order Close Message'. The CloseOrder() function sends 'reason' to ReportError() if the trade closure fails. There is a list of defined constants at the top of the code. You can add to them yourself, and you can pass 'reason' as a string. Suppose you wanted to close half the trade:
Code: [Select all]
 Please Login or Register to see this content
<

CloseOrder() also deletes pending trades, so this might need modifying, depending on what you are trying to achieve.

Example of ModifyOrder() for moving the stop loss:
Code: [Select all]
 Please Login or Register to see this content
<


Bear all this in mind when adding your own custom functions; it will make your life easier.

MPBM
There are basket management features in MPTM, but Baluda has created a dedicated Multi-Purpose Basket Manager. Find it at Baluda @ Baluda Indicators

Versions modified by other coders
I have not necessarily tried them or recommend them or know what the mods are. It just seems fair to apprise members that modifications exist. Experiment with them and see if there is something you can use.
:D
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Global Prime is the official SHF broker. Click here to sign up for a live account with Global Prime and join the 600+ Steve Hopwood members who choose GP as their broker of choice.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Tommaso (milanese) for all the incredible work he does here.
User avatar
SteveHopwood
 
Posts: 9065
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: MPTM's new home

Postby currymonster » Mon Nov 21, 2011 2:02 pm

Thanks Steve,since moving to my new super computer, have lost lots of my old trading buddies, like MPTM. Want to use it with Jiva BB as I'm not getting any stops or TP set on Cowboy Go Markets, order modify failure errors. So hopefully MPTM will kick some butt!

Cheers
currymonster
 
Posts: 100
Joined: Wed Nov 16, 2011 8:37 pm

Re: MPTM's new home

Postby sahars » Thu Nov 24, 2011 2:02 am

Thanks Steve... As always you are awesome....

Cheers
sahars
 
Posts: 13
Joined: Wed Nov 16, 2011 1:44 pm

Re: MPTM's new home

Postby DragosDanescu » Thu Nov 24, 2011 1:25 pm

Some scripts for fast placing of pending orders, including SL, TP, I can customize them in any way possible, just ask.

This pair of scripts have OnWindowDrop function, so they open exactly where you drop them on the chart.
You do not have the required permissions to view the files attached to this post.
Image
DragosDanescu
 
Posts: 103
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: MPTM's new home

Postby SteveHopwood » Thu Nov 24, 2011 3:09 pm

DragosDanescu wrote:Some scripts for fast placing of pending orders, including SL, TP, I can customize them in any way possible, just ask.

This pair of scripts have OnWindowDrop function, so they open exactly where you drop them on the chart.

I have linked this in post 1.

Cheers

:D
Read the effing manual, ok?

Global Prime is the official SHF broker. Click here to sign up for a live account with Global Prime and join the 600+ Steve Hopwood members who choose GP as their broker of choice.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Tommaso (milanese) for all the incredible work he does here.
User avatar
SteveHopwood
 
Posts: 9065
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: MPTM's new home

Postby faxxion » Thu Nov 24, 2011 8:44 pm

Hello Steve,

I have a couple of suggestions for MPTM.

First, has to do with order entry. Just below the EA line in the upper right corner of the chart would be 3 buttons - long (blue), short (red) and close (yellow) just like on the Empty4 order entry window. We would have to tell the inputs what the order was for (single pair, basket, etc...). Then that trade could be entered by a simple click from one chart. This would make those trades easily identifiable by Magic Number. This would be especially helpful for basket trading. After that, the selected money management technique chosen would take over.

Second, has to do with another money management option. Can we add Martingale levels and lot multiplier inputs at each level along with an ultimate stop loss / take profit for the entire trade. For example, if I am long the 1 lot EURUSD and it drops X pips, I can tell it to buy 2 more lots now looking for X profit, but both trades would be stopped out at X pips.

I hope I made myself clear. If some of these functions already exist, please advise. If you have any questions, you have my private email.

Thanks,

William
faxxion
 
Posts: 11
Joined: Wed Nov 16, 2011 8:54 pm

Re: MPTM's new home

Postby SteveHopwood » Thu Nov 24, 2011 9:06 pm

faxxion wrote:Hello Steve,

I have a couple of suggestions for MPTM.

First, has to do with order entry. Just below the EA line in the upper right corner of the chart would be 3 buttons - long (blue), short (red) and close (yellow) just like on the Empty4 order entry window. We would have to tell the inputs what the order was for (single pair, basket, etc...). Then that trade could be entered by a simple click from one chart. This would make those trades easily identifiable by Magic Number. This would be especially helpful for basket trading. After that, the selected money management technique chosen would take over.

Second, has to do with another money management option. Can we add Martingale levels and lot multiplier inputs at each level along with an ultimate stop loss / take profit for the entire trade. For example, if I am long the 1 lot EURUSD and it drops X pips, I can tell it to buy 2 more lots now looking for X profit, but both trades would be stopped out at X pips.

I hope I made myself clear. If some of these functions already exist, please advise. If you have any questions, you have my private email.

Thanks,

William

I might look at this at some stage, but shudder to think of the potential for LUC inviting the entire universe on a bender that would make the Vesuvius eruption look like a hiccough.

So, not yet. Sorry.

Anyone else is welcome to have a go, folks. Although mptm bears my name, there are actually many contributors.

:D
Read the effing manual, ok?

Global Prime is the official SHF broker. Click here to sign up for a live account with Global Prime and join the 600+ Steve Hopwood members who choose GP as their broker of choice.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Tommaso (milanese) for all the incredible work he does here.
User avatar
SteveHopwood
 
Posts: 9065
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: MPTM's new home

Postby oenomaus » Thu Dec 01, 2011 9:56 am

Hello,

I have a problem with MPTM. The broker I use (Trading Point) use different digits for different currencies, some currencies are 4 digits(10$/point for 1lot) and some are 5 digits(1$/point for 1lot). So, when I place the MPTM on a 5 digit chart it calculates the BreakEven(set as 30pips) pips as 300 points which is correct but manages 4digit pairs with same value which equals to 300pips for that currency. The workaround I use is to find the 4digits and 5digits pairs and setup two MPTM for each set, one placed on a 4digit pair and the other onto a 5digit pair.

Is there a way to make MPTM detect this difference automatically? I did not see anything on the manual about this issue.

Thank you.
oenomaus
 
Posts: 0
Joined: Wed Nov 16, 2011 2:35 pm

Re: MPTM's new home

Postby gaheitman » Thu Dec 01, 2011 10:23 am

The way most of the EAs work is to allow you to enter your inputs as Pips, and then in the initialization of the program it converts all these to match the underlying currency's number of digits. As you've pointed out, this doesn't work when managing different currencies (with different digits) from the same chart.

Unfortunately, since it is in the initialization section there is no quick fix.

On the plus side, I now know why one of my scripts is failing on Yen pairs. :D When I fix that script, I will try to keep the issue in mind and come up with a generic solution.

George

oenomaus wrote:Hello,

I have a problem with MPTM. The broker I use (Trading Point) use different digits for different currencies, some currencies are 4 digits(10$/point for 1lot) and some are 5 digits(1$/point for 1lot). So, when I place the MPTM on a 5 digit chart it calculates the BreakEven(set as 30pips) pips as 300 points which is correct but manages 4digit pairs with same value which equals to 300pips for that currency. The workaround I use is to find the 4digits and 5digits pairs and setup two MPTM for each set, one placed on a 4digit pair and the other onto a 5digit pair.

Is there a way to make MPTM detect this difference automatically? I did not see anything on the manual about this issue.

Thank you.
User avatar
gaheitman
 
Posts: 644
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: MPTM's new home

Postby SteveHopwood » Thu Dec 01, 2011 9:23 pm

oenomaus wrote:Hello,

I have a problem with MPTM. The broker I use (Trading Point) use different digits for different currencies, some currencies are 4 digits(10$/point for 1lot) and some are 5 digits(1$/point for 1lot). So, when I place the MPTM on a 5 digit chart it calculates the BreakEven(set as 30pips) pips as 300 points which is correct but manages 4digit pairs with same value which equals to 300pips for that currency. The workaround I use is to find the 4digits and 5digits pairs and setup two MPTM for each set, one placed on a 4digit pair and the other onto a 5digit pair.

Is there a way to make MPTM detect this difference automatically? I did not see anything on the manual about this issue.

Thank you.

I first coded mptm in the good ole days when all quotes were 2/4. The crims introduced 3/5 digit quotes deliberately to try to confuse everyone. Once we are used to 3/5 quotes, they will introduce 6/8. There is no limit on this until we traders dig our heels in and stop them.

Having said that, mptm always had to differentiate between different Bid, Ask, Point and Digit values. I overcame this by setting up variables that have the same name but without the capital letter. They are bid, ask, point, digit. (Shut up George. I did this deliberately so I know which variables I was addressing each time, and have no problem remembering to leave off the leading cap, ok? :lol: )

Therefore, mptm already addresses automatically the different Digit sizes, up to 5. If your crim has come up with a way of pissing around with all this by, for example, variable Digits from quote to quote (doubtless the next trick these bastards will come up with to 'help our valued clients make the most of their incomparable trading experience') then some of the mptm code might be rendered useless. I don't care. If the crims piss you around, then find one that does so a little less.

:D
Read the effing manual, ok?

Global Prime is the official SHF broker. Click here to sign up for a live account with Global Prime and join the 600+ Steve Hopwood members who choose GP as their broker of choice.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Tommaso (milanese) for all the incredible work he does here.
User avatar
SteveHopwood
 
Posts: 9065
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Next

Return to Utilities Indicators and Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

cron