MPTM's new home

MPTM's new home
Locked
User avatar
tex
Trader
Posts: 89
Joined: Wed Nov 16, 2011 7:27 am

Re: MPTM's new home

Post by tex »

Hey Steve,

would it be possible to include an "close all trades on day x / daytime (e.g. friday / 18:00) option" ?

thanks,
tex
User avatar
nick4ex
Posts: 4
Joined: Thu Nov 24, 2011 8:15 pm
Location: Berlin

Re: MPTM's new home

Post by nick4ex »

Hi Steve,
first of all many thanks for that powerful tool. It supports me a lot in my trading. I am just working with your EA since 3 weeks.

Your EA have a lot of options you can work with. But there was something (or not :lol: ) what I really missed.

Most of the time I close 50% of my lotsize after 20pips and move the sl >BE. For each trade the lotsize depends on the risk and pair and I don't want to loose not more than 1% of my account. For that purpose I am using a script.

Because of the missing "percentage" option I changed one line in your EA as followed:
//bool result=OrderClose(OrderTicket(), Close_Lots, price, 5, CLR_NONE);
changing in:
bool result=OrderClose(OrderTicket(), Close_Lots * OrderLots(), price, 5, CLR_NONE);
It is certainly a "quick and dirty" solution, because I am not a programer only a user but at the moment it works.

Do you see any problem with my adjustment?

Maybe you can enhance it and integrate a switch like
percentage - false/ true
fix lotsize - false true (if one true the other have to be false) Just an idea :idea:

Concerning your EA I have two other questions.

ATR Stop (SL): Imagine I am using this option. What happen if I am trading a countertrend strategy. In that case most of the time the ATR STop is on the "other side of the table". Does it happen that the SL ATR Stop is now changing in a TP ATR Stop and if yes does the EA switch off the ATRStop (or other option)?

Jumping Stop: For each 20pips I reduce 50% of the remaining lotsize and sl is also jumping 20p (just an example). What and where I have to insert that information?

Many thanks Steve and as I said it is a brilliant work.

Nick
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: MPTM's new home

Post by gaheitman »

nick4ex wrote:Hi Steve,
first of all many thanks for that powerful tool. It supports me a lot in my trading. I am just working with your EA since 3 weeks.

Your EA have a lot of options you can work with. But there was something (or not :lol: ) what I really missed.

Most of the time I close 50% of my lotsize after 20pips and move the sl >BE. For each trade the lotsize depends on the risk and pair and I don't want to loose not more than 1% of my account. For that purpose I am using a script.

Because of the missing "percentage" option I changed one line in your EA as followed:
//bool result=OrderClose(OrderTicket(), Close_Lots, price, 5, CLR_NONE);
changing in:
bool result=OrderClose(OrderTicket(), Close_Lots * OrderLots(), price, 5, CLR_NONE);
It is certainly a "quick and dirty" solution, because I am not a programer only a user but at the moment it works.

Do you see any problem with my adjustment?

Maybe you can enhance it and integrate a switch like
percentage - false/ true
fix lotsize - false true (if one true the other have to be false) Just an idea :idea:

Concerning your EA I have two other questions.

ATR Stop (SL): Imagine I am using this option. What happen if I am trading a countertrend strategy. In that case most of the time the ATR STop is on the "other side of the table". Does it happen that the SL ATR Stop is now changing in a TP ATR Stop and if yes does the EA switch off the ATRStop (or other option)?

Jumping Stop: For each 20pips I reduce 50% of the remaining lotsize and sl is also jumping 20p (just an example). What and where I have to insert that information?

Many thanks Steve and as I said it is a brilliant work.

Nick
Nick,

I'm starting to look into MPTM, so I thought I'd take a crack at answering your question.

I am assuming that you are using Close_Lots as a percentage now, correct? So you have it set to .5? I don't see an issue with that. Though you might want to have some minimum lot size so you close the whole thing, especially considering your later question.

The UseSlAtr simply uses ATR to determine the size of the SL, not the direction. So if you have a buy order, the ATR stop will be below the entry and if you have a sell it will be above it.

Here's the code:

Code: Select all

      
//for buys
   if (UseSlAtr) SL = NormalizeDouble(OrderOpenPrice() - AtrVal, digits);

//for sells
   if (UseSlAtr) SL = NormalizeDouble(OrderOpenPrice() + AtrVal, digits);
For your jumping stop example, if you have PartCloseEnabled=true (which you should if you are closing 50% at 20) it should be working that way already. You'll need to make sure that Preserve_Lots is set correctly for your lot size, since it will stop closing 50% once your trade gets to that size.

The code:

Code: Select all

if (PartCloseEnabled && OrderLots() > Preserve_Lots)// Only try to do this if the jump stop worked
   bool PartCloseSuccess = PartCloseTradeFunction();
George
User avatar
SteveHopwood
Owner
Posts: 9754
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

Post by SteveHopwood »

nick4ex wrote:Hi Steve,
first of all many thanks for that powerful tool. It supports me a lot in my trading. I am just working with your EA since 3 weeks.

Your EA have a lot of options you can work with. But there was something (or not :lol: ) what I really missed.

Most of the time I close 50% of my lotsize after 20pips and move the sl >BE. For each trade the lotsize depends on the risk and pair and I don't want to loose not more than 1% of my account. For that purpose I am using a script.

Because of the missing "percentage" option I changed one line in your EA as followed:
//bool result=OrderClose(OrderTicket(), Close_Lots, price, 5, CLR_NONE);
changing in:
bool result=OrderClose(OrderTicket(), Close_Lots * OrderLots(), price, 5, CLR_NONE);
It is certainly a "quick and dirty" solution, because I am not a programer only a user but at the moment it works.

Do you see any problem with my adjustment?

Maybe you can enhance it and integrate a switch like
percentage - false/ true
fix lotsize - false true (if one true the other have to be false) Just an idea :idea:

Concerning your EA I have two other questions.

ATR Stop (SL): Imagine I am using this option. What happen if I am trading a countertrend strategy. In that case most of the time the ATR STop is on the "other side of the table". Does it happen that the SL ATR Stop is now changing in a TP ATR Stop and if yes does the EA switch off the ATRStop (or other option)?

Jumping Stop: For each 20pips I reduce 50% of the remaining lotsize and sl is also jumping 20p (just an example). What and where I have to insert that information?

Many thanks Steve and as I said it is a brilliant work.

Nick
I leave you in George's capable hands. He understands coding - I don't. :lol:

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

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 Thomas (tomele) for all the incredible work he does here.
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: MPTM's new home

Post by gaheitman »

SteveHopwood wrote:
I leave you in George's capable hands. He understands coding - I don't. :lol:

:D[/quote]

As we say in the states "PSHAW!" :D

George
User avatar
nick4ex
Posts: 4
Joined: Thu Nov 24, 2011 8:15 pm
Location: Berlin

Re: MPTM's new home

Post by nick4ex »

Hi George,

many thanks for your fast answer and its fine that you understand my English :D

Yes, I am using 50% and in field "Close_Lot" I set 0.5. As I understand you are saying that the 50% works only once. But this is not my intention.
If I start with 1lot in the first step 0.5 will remain, second step 0.25 etc. Isn't that way how it works?

Concerning jumping stop. You are showing the code. Thanks but most of that stuff is really "cryptical" for me. May I ask you again as a user of this ea. What field in the above section I have to fill to get the result of:
Set after 20p +2 on BE and part close 50% of the orderlots, after the next jump of 20p close again 50% of the remaining orderlots, and after the next 20p same procedere.

Concerning "SL ATRStop" I will give you an other example. My entry is on a M5 base but my setting of "SL ATRStop" is based on H1 and in this case it happens quite often that the ATR is on the other side of my direction. How is the reaction of this EA?

Many thanks in advance George

Nick
User avatar
mobthehop
Trader
Posts: 362
Joined: Wed Nov 16, 2011 12:16 am

Re: MPTM's new home

Post by mobthehop »

Steve, quick question - would like to use MPTM for basket trading... all basket positions same lot size, basket to remain untouched, trading positions will have different / larger position size than basket positions. Would you consider to add trade / close by position size functionality to the EA please?
User avatar
SteveHopwood
Owner
Posts: 9754
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

Post by SteveHopwood »

mobthehop wrote:Steve, quick question - would like to use MPTM for basket trading... all basket positions same lot size, basket to remain untouched, trading positions will have different / larger position size than basket positions. Would you consider to add trade / close by position size functionality to the EA please?
Nope. Sorry. Too specialised. Nothing to stop you doing the same, though.

Cheers

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

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 Thomas (tomele) for all the incredible work he does here.
dusktrader
Trader
Posts: 13
Joined: Tue Nov 22, 2011 3:52 pm
Location: North Carolina

Re: MPTM's new home

Post by dusktrader »

Hello Steve, just popping in to show some gratitude for building MTPM. I tried several different pieces of code to handle automated order-closure (which is the way I trade btw, hitting stops to make my profit, not hitting takeprofit levels). MPTM was by far the most comprehensive and flexible solution and it has been working great!

I do have a couple ideas I wanted to run by you. These are all things that could help with my trading style. I may try to take a stab at coding some of these, but I don't think I could implement the complicated ideas (yet).

IDEA #1: FIFO compliant with Global Order Closure
I use the Global Order Closure feature almost daily, because my research has shown that trades left open into the Asian session tend to become losers. Around 5pm Eastern (NY close) I implement Global Order Closure to gracefully terminate any open positions. One problem I've seen is that MPTM does not follow FIFO rules, apparently. When it issues a closure order "out of order" I get an error in my platform and that trade does not close. This might be a really simple thing to fix, such as sorting the active orders by order number. I'm not 100% sure how FIFO works, but I think a sequence number could be available to help with this.

IDEA #1b: sanity checks for Global Order Closure
Related to idea #1, I've noticed that once MPTM "thinks" it has closed all orders, it will kick back and stop trying. This could leave hanging active orders if they were not closed due to the crim not accepting the order for any reason. This snowballs into a bigger issue because, for example, Global Order Closure is looking (in my case) for a balance figure that it can no longer find, due to the majority of trades now closed. As such, my request here would be that Global Order Closure become more vigilant... when it knows it has issued global closure, it should be vigilant to keep retrying the orders until all trades are really gone.

IDEA #2: Email alerts
I know this is corny, but I'm an obsessive trader. When I leave the slavejob for my commute (and thus leave my account in MPTM's capable robo-hands), I'd LOVE to know when a Global Order Closure has occurred (or any other MPTM activity I suppose, given the circumstance). My commute is about an hour, and during that whole time I wonder whether or not my orders are still open or not. LOL. I would only use email alerts in a rare circumstance, but this is one of them.

IDEA #3: Spread handling for Oanda Empty4 (maybe?)
I'm trying to get a handle on whether or not Oanda Empty4 handles spreads in the same way that they do with their native fxTrade platform. fxTrade charges half the spread on ALL buys and sells, which is a bit nonstandard compared to most Empty4 crims. If Oanda Empty4 works the same way, then the idea here would be to allow special handling of Oanda accounts with MPTM. I believe you already handle spreads, so this feature request would be for special handling on Oanda only.

IDEA #4: Bid-chart (visual) trading feature
Not sure if this idea even will make sense (or if its a good one), but I think it could be. I will try to describe it here. This assumes MPTM is already handling spreads in the traditional fashion, which is to add full spread to buys, but not to sells (right?)

In my current manual strategy, I am always looking at a bid chart. As such, I would think it makes sense for MPTM also to look at the bid chart. Dynamic spread adjustment by the crim can cause havoc in a purely visual method, as I'm sure you understand. In other words, if my target is a visual level, then that is based on my presumption of the spread at the time I entered the trade. However, by the time price reaches that visual level, dynamic spread may be different. For that matter, even pair-to-pair spread is different, so it makes sense (at least in my mind) to consider the target level reached when it is VISUALLY at the level, which is how the strategy was designed to begin with.

So this feature "bid-chart trading" would essentially turn-off the spread handling for targets I think. If my target level order would be a BUY EURUSD @ 20 pips, I think MPTM would normally buy at the ASK price which would include spread of 2. That would cause the buy to execute at visually 22 pips I believe. So my suggestion for this feature would be to actually execute at 18 pips (still buying at the ASK price, but in alignment with the visual BID chart).

THANKS STEVE for considering these ideas :)
Image
User avatar
SteveHopwood
Owner
Posts: 9754
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

Post by SteveHopwood »

dusktrader wrote:Hello Steve, just popping in to show some gratitude for building MTPM. I tried several different pieces of code to handle automated order-closure (which is the way I trade btw, hitting stops to make my profit, not hitting takeprofit levels). MPTM was by far the most comprehensive and flexible solution and it has been working great!

I do have a couple ideas I wanted to run by you. These are all things that could help with my trading style. I may try to take a stab at coding some of these, but I don't think I could implement the complicated ideas (yet).

IDEA #1: FIFO compliant with Global Order Closure
I use the Global Order Closure feature almost daily, because my research has shown that trades left open into the Asian session tend to become losers. Around 5pm Eastern (NY close) I implement Global Order Closure to gracefully terminate any open positions. One problem I've seen is that MPTM does not follow FIFO rules, apparently. When it issues a closure order "out of order" I get an error in my platform and that trade does not close. This might be a really simple thing to fix, such as sorting the active orders by order number. I'm not 100% sure how FIFO works, but I think a sequence number could be available to help with this.

IDEA #1b: sanity checks for Global Order Closure
Related to idea #1, I've noticed that once MPTM "thinks" it has closed all orders, it will kick back and stop trying. This could leave hanging active orders if they were not closed due to the crim not accepting the order for any reason. This snowballs into a bigger issue because, for example, Global Order Closure is looking (in my case) for a balance figure that it can no longer find, due to the majority of trades now closed. As such, my request here would be that Global Order Closure become more vigilant... when it knows it has issued global closure, it should be vigilant to keep retrying the orders until all trades are really gone.

IDEA #2: Email alerts
I know this is corny, but I'm an obsessive trader. When I leave the slavejob for my commute (and thus leave my account in MPTM's capable robo-hands), I'd LOVE to know when a Global Order Closure has occurred (or any other MPTM activity I suppose, given the circumstance). My commute is about an hour, and during that whole time I wonder whether or not my orders are still open or not. LOL. I would only use email alerts in a rare circumstance, but this is one of them.

IDEA #3: Spread handling for Oanda Empty4 (maybe?)
I'm trying to get a handle on whether or not Oanda Empty4 handles spreads in the same way that they do with their native fxTrade platform. fxTrade charges half the spread on ALL buys and sells, which is a bit nonstandard compared to most Empty4 crims. If Oanda Empty4 works the same way, then the idea here would be to allow special handling of Oanda accounts with MPTM. I believe you already handle spreads, so this feature request would be for special handling on Oanda only.

IDEA #4: Bid-chart (visual) trading feature
Not sure if this idea even will make sense (or if its a good one), but I think it could be. I will try to describe it here. This assumes MPTM is already handling spreads in the traditional fashion, which is to add full spread to buys, but not to sells (right?)

In my current manual strategy, I am always looking at a bid chart. As such, I would think it makes sense for MPTM also to look at the bid chart. Dynamic spread adjustment by the crim can cause havoc in a purely visual method, as I'm sure you understand. In other words, if my target is a visual level, then that is based on my presumption of the spread at the time I entered the trade. However, by the time price reaches that visual level, dynamic spread may be different. For that matter, even pair-to-pair spread is different, so it makes sense (at least in my mind) to consider the target level reached when it is VISUALLY at the level, which is how the strategy was designed to begin with.

So this feature "bid-chart trading" would essentially turn-off the spread handling for targets I think. If my target level order would be a BUY EURUSD @ 20 pips, I think MPTM would normally buy at the ASK price which would include spread of 2. That would cause the buy to execute at visually 22 pips I believe. So my suggestion for this feature would be to actually execute at 18 pips (still buying at the ASK price, but in alignment with the visual BID chart).

THANKS STEVE for considering these ideas :)
dusktrader, sorry but I haven't even read them. Have you seen the inputs list? Can you even begin to comprehend how many thousands of lines of code lie behind them?

And you want me to add to all this? Any idea what happens when someone adds to all this?

Come across LUC yet? If not, visit the acronym thread to work out what LUC stands for. Trust me when I say that attempts to modify mtpm's code will probably lead to LUC throwing the kind of bender that would stop the world.

Scanning your post, I see a mention of FIFO. This manifest piece of fraudery is not something I am going to accommodate. If we have a list of trades that need closing and the trades are in a descending order of trade sizes, then we need them closing in order of LIFO. Now, I am truly sorry that my US cousins suffer from a regime that is directly aimed at favouring rich criminals over the little guy, but I am not going to disadvantage traders in the whole of the rest of the world simply to accommodate this behaviour - especially me.

So, do what I did. Learn to code mql4 and make the modifications you need yourself. I am not being sarcastic here. Many hate it when I say this, but it is nevertheless a fact: all traders should also be coders. When you become one, you will understand why.

And yes, I know all the reasons why you cannot be a coder. They have all been offered many times before by those unable to grasp this simple, unbreakable unshakeable fact: all traders using the Empty4 platform should also be coders.

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

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 Thomas (tomele) for all the incredible work he does here.
Locked

Return to “Utilities Indicators and Scripts”