MPTM updated

MPTM's new home

MPTM updated

Postby Fourxxxx » Mon Dec 14, 2020 8:50 pm

SteveHopwood » Tue Dec 15, 2020 5:39 am wrote:You are talking about the likes of SS and HGI as included with MPTM?

:xm: :rocket:


Yes that is correct ie if I use your HGI scripts it opens many pending trades and the market may not reach all of them. So if an indicator closes a trade it would be useful to delete the remaining pending orders also.
Fourxxxx
 
Posts: 63
Joined: Fri Feb 24, 2012 4:50 am

MPTM updated

Postby danjuma » Wed Dec 16, 2020 9:03 pm

There are two exactly named MPTM mq4 files attached to post 1, are they the same or different in some ways?
danjuma
 
Posts: 75
Joined: Mon Jun 10, 2013 4:14 pm

MPTM updated

Postby SteveHopwood » Thu Dec 17, 2020 10:16 am

danjuma » Wed Dec 16, 2020 9:03 pm wrote:There are two exactly named MPTM mq4 files attached to post 1, are they the same or different in some ways?

No idea how that happened. They both have 1d as their version.

I will be posting an update soon so you will know you have the latest version if you download the update.

:xm: :rocket:
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 several thousand SHF members who wisely 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: 9468
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

MPTM updated

Postby danjuma » Thu Dec 17, 2020 12:39 pm

SteveHopwood » Thu Dec 17, 2020 10:16 am wrote:
danjuma » Wed Dec 16, 2020 9:03 pm wrote:There are two exactly named MPTM mq4 files attached to post 1, are they the same or different in some ways?

No idea how that happened. They both have 1d as their version.

I will be posting an update soon so you will know you have the latest version if you download the update.

:xm: :rocket:


Thank you Steve. And a merry Xmas to you (in which ever form that takes for you in this Covid, lock-down and tiers times!)
danjuma
 
Posts: 75
Joined: Mon Jun 10, 2013 4:14 pm

MPTM updated

Postby SteveHopwood » Sat Dec 19, 2020 12:36 pm

V 1e is in post 1.

The HGI/SS/MA closure functions were only looking at market trades, which is why the stop and limit orders were ignored. This should be fixed now.

To DIY to preserve you hard coded inputs, go to the bool ShouldThisTradeBeClosed(int ticket) function. The next three functions down are:
  • bool UsingBobMaForTradeClosing(int ticket)
  • bool UsingHgiToCloseTrade(int ticket)
  • bool UsingSuperSlopeToCloseThisTrade(int ticket)

Go to each function and scroll down to:
if (OrderType() == OP_BUY)
Add the stop/limit order conditionals so that the line of code becomes:
if (OrderType() == OP_BUY || OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT)

Then scroll down to:
if (OrderType() == OP_SELL)
Change it to:
if (OrderType() == OP_SELL || OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT)

Thanks for pointing this out danjuma.

:xm: :rocket:
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 several thousand SHF members who wisely 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: 9468
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

MPTM updated

Postby Fourxxxx » Fri Jan 08, 2021 7:17 am

My coding skills are limited so please understand.

I am trying to get MPTM to close trades using the MA but only to become active after the trade has moved into profit. This because with the system I am using the price is often on the wrong side of the MA at entry. Without modification, MPTM would close these trades at entry.

This is what I have tried but it is not always closing trades when the close is on the wrong side of the MA and in profit.
Code: [Select all]
 Please Login or Register to see this content
<


This line if (iClose(OrderSymbol(), MaTFC, 1) >= OrderOpenPrice()) //FourXXXX is intended to stop the closure happening unless the trade is on the profit side of the open.

Any tips appreciated and sorry if this causes any bother.
Fourxxxx
 
Posts: 63
Joined: Fri Feb 24, 2012 4:50 am

MPTM updated

Postby SteveHopwood » Fri Jan 08, 2021 11:56 am

Fourxxxx » Fri Jan 08, 2021 7:17 am wrote:My coding skills are limited so please understand.

I am trying to get MPTM to close trades using the MA but only to become active after the trade has moved into profit. This because with the system I am using the price is often on the wrong side of the MA at entry. Without modification, MPTM would close these trades at entry.

This is what I have tried but it is not always closing trades when the close is on the wrong side of the MA and in profit.
Code: [Select all]
 Please Login or Register to see this content
<


This line if (iClose(OrderSymbol(), MaTFC, 1) >= OrderOpenPrice()) //FourXXXX is intended to stop the closure happening unless the trade is on the profit side of the open.

Any tips appreciated and sorry if this causes any bother.


I don't know if this will help but what I would do is:
  • Insert a check that the order is in profit underneath the BetterOrderSelect.
  • Remove the unwanted conditionals for OP_BUYSTOP etc.
  • Remove the if (iClose(OrderSymbol(), MaTFC, 1) >= OrderOpenPrice()) //FourXXXX from the two blocks.

Like this:

Code: [Select all]
 Please Login or Register to see this content
<


The reason I am not sure this helps is that I cannot see why your adaptation is not working.

We always think it is the code we added that is at fault, but sometimes the problem lies elsewhere. Go to the void OnTimer() function and make sure none of your inputs are causing the function to abort before reaching the DoTradeManagement(); call.

:xm: :rocket:
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 several thousand SHF members who wisely 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: 9468
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

MPTM updated

Postby Fourxxxx » Fri Jan 08, 2021 12:37 pm

SteveHopwood » Fri Jan 08, 2021 9:56 pm wrote:
I don't know if this will help but what I would do is:
  • Insert a check that the order is in profit underneath the BetterOrderSelect.
  • Remove the unwanted conditionals for OP_BUYSTOP etc.
  • Remove the if (iClose(OrderSymbol(), MaTFC, 1) >= OrderOpenPrice()) //FourXXXX from the two blocks.

Like this:

Code: [Select all]
 Please Login or Register to see this content
<


The reason I am not sure this helps is that I cannot see why your adaptation is not working.

We always think it is the code we added that is at fault, but sometimes the problem lies elsewhere. Go to the void OnTimer() function and make sure none of your inputs are causing the function to abort before reaching the DoTradeManagement(); call.

:xm: :rocket:


Thanks Steve, I have your suggestions running now on test. If it works it will still sometimes be closing trades at near the open as my entry trigger is often several pips on the wrong side of the MA 5 with shift of 2. Might be easier for me to just write an EA to go on each chart to handle the MA cross close.
Fourxxxx
 
Posts: 63
Joined: Fri Feb 24, 2012 4:50 am

MPTM updated

Postby SteveHopwood » Fri Jan 08, 2021 2:18 pm

Fourxxxx » Fri Jan 08, 2021 12:37 pm wrote:
Thanks Steve, I have your suggestions running now on test. If it works it will still sometimes be closing trades at near the open as my entry trigger is often several pips on the wrong side of the MA 5 with shift of 2. Might be easier for me to just write an EA to go on each chart to handle the MA cross close.


You need to compare the close at shift 2 with the close at shift 1 to detect a cross.

Code: [Select all]
 Please Login or Register to see this content
<


Needing the order to be in profit before closing would negate the MA cross and so would never result in the order closing.

:xm: :rocket:
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 several thousand SHF members who wisely 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: 9468
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

MPTM updated

Postby Fourxxxx » Sat Jan 09, 2021 1:15 am

Thank you Steve, I see now my original logic was flawed, to me it looks like the code you wrote would act as per the image, which is exactly what I am trying to achieve.

MA Cross Close.jpg


A buy at the yellow circle (which is an actual trade I entered) would close in profit at the red circled close after previously closing above the red MA then closing below it if I am understanding the code correctly. Now I will have to wait till Monday to see how it goes.
You do not have the required permissions to view the files attached to this post.
Fourxxxx
 
Posts: 63
Joined: Fri Feb 24, 2012 4:50 am

PreviousNext

Return to Utilities Indicators and Scripts

Who is online

Users browsing this forum: No registered users and 0 guests