MPTM updated

MPTM's new home
Post Reply
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.

MPTM updated

Post by SteveHopwood »

stevenforex » Fri Oct 16, 2020 8:03 am wrote:
Hey Steve!

I just checked the code a bit and found that in the DoTradeManagement() the part-close Lot-Size calculation is done twice. Lines 1891 and 1915

One using the "CloseEnough()" and the other one without...

Could that be the problem?

If the compare of the two doubles gets different results for both parts :?

Cheers
You probably guessed that I forgot all about this.

The Close_Lots calculation is not needed twice but would make no difference as it will result in the same value. Delete the second calculation.

I will manage some trades next week and see if I can work out what is wrong.

:xm: :rocket:
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.
K-Lander
Trader
Posts: 35
Joined: Thu Nov 17, 2011 9:03 pm
Location: Buenos Aires, Argentina

Minor bug on MPTM

Post by K-Lander »

Hi folks,
Just found a small bug on MPTM´s InsertTakeProfit function (line 1732). When calculating the TP, it does so from current price instead of the order´s open price. The needed changes are as follows:

Line # ..... Replace... ....... With...
1753........ ask............ OrderOpenPrice()
1762........ bid............ OrderOpenPrice()


Credit goes to laziness, as I couldn´t be bothered to manually placing the SL and TP to some pending orders, which led to finding the glitch.

I am not attaching the amended EA as it would not be an authentic, certified, made-in-Hopwoodshire version of the thing.

My very small $0.02.

Cheers,
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.

Minor bug on MPTM

Post by SteveHopwood »

K-Lander » Mon Nov 16, 2020 2:48 pm wrote:Hi folks,
Just found a small bug on MPTM´s InsertTakeProfit function (line 1732). When calculating the TP, it does so from current price instead of the order´s open price. The needed changes are as follows:

Line # ..... Replace... ....... With...
1753........ ask............ OrderOpenPrice()
1762........ bid............ OrderOpenPrice()


Credit goes to laziness, as I couldn´t be bothered to manually placing the SL and TP to some pending orders, which led to finding the glitch.

I am not attaching the amended EA as it would not be an authentic, certified, made-in-Hopwoodshire version of the thing.

My very small $0.02.

Cheers,
Not sure what you are looking at; the code is correct in my version and in the post 1 version. Are you sure yours is up to date?

:xm: :rocket:
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.
K-Lander
Trader
Posts: 35
Joined: Thu Nov 17, 2011 9:03 pm
Location: Buenos Aires, Argentina

Minor bug on MPTM

Post by K-Lander »

SteveHopwood » Mon Nov 16, 2020 1:19 pm wrote:
K-Lander » Mon Nov 16, 2020 2:48 pm wrote:Hi folks,


Not sure what you are looking at; the code is correct in my version and in the post 1 version. Are you sure yours is up to date?

:xm: :rocket:
Seems I have an old version of MPTM and the bug seems to have been fixed in the updated one. My bad, sorry.

Have a nice weekend

K
Fourxxxx

MPTM updated

Post by Fourxxxx »

I seem to be missing something trying to get MPTM to close trades using HGI Blue Wavy lines.

I have the latest HGI Indicators and library files (fresh download) installed and HGI is displaying on the charts. MPTM will close trades if I set take profit in Pips but I would like it to close trades when the Blue Wavy lines are displayed. I have tried everything but I am running out of hair to pull out very fast.
MPTM 4H.tpl
You do not have the required permissions to view the files attached to this post.
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.

MPTM updated

Post by SteveHopwood »

Fourxxxx » Tue Nov 24, 2020 1:54 am wrote:I seem to be missing something trying to get MPTM to close trades using HGI Blue Wavy lines.

I have the latest HGI Indicators and library files (fresh download) installed and HGI is displaying on the charts. MPTM will close trades if I set take profit in Pips but I would like it to close trades when the Blue Wavy lines are displayed. I have tried everything but I am running out of hair to pull out very fast.
You will be sort of glad to know that the fault was in the coding, not in your attempts to use mptm. Fixed in 1c in post 1.

Coders and most DIYers will understand the bloop immediately. Go to the bool UsingHgiToCloseTrade(int ticket) function and scroll down to:
//The HGI library functionality was added by tomele. Many thanks Thomas.

These two lines need editing:
signal = getHGISignal(Symbol(), HgiTimeFrameC, shift);//This library function looks for arrows.
slope = getHGISlope (Symbol(), HgiTimeFrameC, shift);//This library function looks for wavy lines.

Change the highlighted words to these:
signal = getHGISignal(OrderSymbol(), HgiTimeFrameC, shift);//This library function looks for arrows.
slope = getHGISlope (OrderSymbol(), HgiTimeFrameC, shift);//This library function looks for wavy lines.

FYI folks, in looking for the fault I noticed how similar the hgi closure input names were to the hgi hedging input names, so I changed them. It should not affect the running of mptm if you leave yours as they are.


:xm: :rocket:
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.
Fourxxxx

MPTM updated

Post by Fourxxxx »

Thank you :clap: :clap: :clap: :clap: still testing but seems to be closing trades as expected for Blue Wavy lines. The logic for the Yellow Wavy's does not seem right though. I have changed it to this and seems to be doing what I need.
if (slope == RANGEABOVE && HgiCloseOnYellowWavyC) and if (slope==RANGEBELOW && HgiCloseOnYellowWavyC)
R

Code: Select all

   if (OrderType() == OP_BUY)
   {
      if (signal==TRENDDN && HgiCloseOnLargeArrowsC)
      {
         //HgiStatus = hgidownarrowtradable;
         return(true);
      }
      else 
      if (slope==TRENDABOVE && HgiCloseOnBlueWavyC)
      {
         //HgiStatus = hgibluewavyshort;
         return(true);
      }
      else
      if (slope == RANGEABOVE && HgiCloseOnYellowWavyC)
      {
         //HgiStatus = hgiyellowrangewaveydown;
         return(true);
      }//if (slope == RANGEBELOW)      
   
   }//if (OrderType() == OP_BUY)

   if (OrderType() == OP_SELL)
   {
      if (signal==TRENDUP && HgiCloseOnLargeArrowsC)
      {
         //HgiStatus = hgiuparrowtradable;
         return(true);
      }
      else 
      if (slope==TRENDBELOW && HgiCloseOnBlueWavyC)
      {
         //HgiStatus = hgibluewavylong;
         return(true);
      }
      else 
      if (slope==RANGEBELOW && HgiCloseOnYellowWavyC)
      {
         //HgiStatus = hgiyellowrangewaveyup;
         return(true);
      }//if (slope==RANGEABOVE)
   
   }//if (OrderType() == OP_SELL)
if (slope == RANGEABOVE && HgiCloseOnYellowWavyC) and if (slope==RANGEBELOW && if (slope == RANGEABOVE && HgiCloseOnYellowWavyC) and if (slope==RANGEBELOW && HgiCloseOnYellowWavyC)giCloseOnYellowWavyC) were the other way around in Buy and Sell.
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.

MPTM updated

Post by SteveHopwood »

:xm:
Fourxxxx » Wed Nov 25, 2020 2:03 am wrote:The logic for the Yellow Wavy's does not seem right though.
Thanks for a really helpful contribution. :clap: :clap: :clap: :clap: I have added the fix to 1c in post 1. Remember folks, if you are updating from post 1, to delete the existing .ex4 file to force recompilation when you restart the platform.

I have added a slightly different solution to Fourxxxx's, so the easiest DIY is to copy the entire function over the top of the existing one:

Code: Select all

bool UsingHgiToCloseTrade(int ticket)
{

   //Returns 'true' if HGI generates an opposite signal, else 'false'

   if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
      return(false);
      
   
   int shift = 0;
   if (HgiOnlyConfirmedSignalsC)
      shift = 1;

   //No need to read the previous candle at every timer event
   static datetime OldBarTime = 0;
   if (!HgiOnlyConfirmedSignalsC)
      OldBarTime = 0;//Force a read at every timer event.
   if (OldBarTime == iTime(OrderSymbol(), HgiTimeFrameC, 0) )
      return(false);
   OldBarTime = iTime(OrderSymbol(), HgiTimeFrameC, 0);
      
   SIGNAL signal = 0;
   SLOPE  slope  = 0;

   //HgiStatus = hginosignal;
   
   //The HGI library functionality was added by tomele. Many thanks Thomas.
   signal = getHGISignal(OrderSymbol(), HgiTimeFrameC, shift);//This library function looks for arrows.
   slope  = getHGISlope (OrderSymbol(), HgiTimeFrameC, shift);//This library function looks for wavy lines.



   if (OrderType() == OP_BUY)
   {
      if (signal==TRENDDN && HgiCloseOnLargeArrowsC)
      {
         //HgiStatus = hgidownarrowtradable;
         return(true);
      }
      else 
      if (slope==TRENDABOVE && HgiCloseOnBlueWavyC)
      {
         //HgiStatus = hgibluewavyshort;
         return(true);
      }
      
   }//if (OrderType() == OP_BUY)

   if (OrderType() == OP_SELL)
   {
      if (signal==TRENDUP && HgiCloseOnLargeArrowsC)
      {
         //HgiStatus = hgiuparrowtradable;
         return(true);
      }
      else 
      if (slope==TRENDBELOW && HgiCloseOnBlueWavyC)
      {
         //HgiStatus = hgibluewavylong;
         return(true);
      }
     
   }//if (OrderType() == OP_SELL)
   
   //Yellow wavy closure
   if (HgiCloseOnYellowWavyC)
      if (slope==RANGEABOVE || slope == RANGEBELOW)
         return(true);
   
      

   //Got this far, so no signal
      return(false);
      
}//End bool UsingHgiToCloseTrade(int ticket
:xm: :rocket:
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.
Fourxxxx

MPTM updated

Post by Fourxxxx »

Thank you for the fixes so far, is it possible to have the option to close all Pending Orders for the same pair when an indicator close is triggered, 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.

MPTM updated

Post by SteveHopwood »

Fourxxxx » Mon Dec 14, 2020 3:42 am wrote:Thank you for the fixes so far, is it possible to have the option to close all Pending Orders for the same pair when an indicator close is triggered, please?
You are talking about the likes of SS and HGI as included with MPTM?

:xm: :rocket:
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.
Post Reply

Return to “Utilities Indicators and Scripts”