MPTM's new home

MPTM's new home
Locked
User avatar
wolfeman
Trader
Posts: 143
Joined: Thu Nov 17, 2011 6:15 am
Location: Slumming it in sunny California

Re: MPTM's new home

Post by wolfeman »

Hi Steve,

I wonder if anyone has suggested yet another add-on to MPTM. A slope exit would be flippin' awesome. Especially if the user could select- say, a 4,6,8 or 10 cross for exit. Something to ponder on that day in 2025 that you have nothing to do...(because you'll be rich and retired by then)
HiArt99
Posts: 7
Joined: Thu Jul 12, 2012 8:50 am

Re: MPTM's new home

Post by HiArt99 »

Hi Steve,

being a hack coder, I tracked down the issue for commodities and Indices on MPTM.

The PFactor factor subroutine did not cater for them, and my criminal doesn't use the same code for Gold for example.

To address this I have added 3 external strings:

Code: Select all

extern string  BetPer1Pairs                  ="UK100,WS30,DAX30,NAS100,CAC40";
extern string  BetPer10thsPairs              ="GOLD,SP500";
extern string  BetPer100thsPairs             ="WTI,BRENT,SILVER,JPY";
Now I have been through my pairs and pressed F9 to open a trade. If it said "bet per 1" the pair stub went in my "BetPer1Pairs", and so on. I have done this so folks whose criminals use different names (WTI is crude for me, but it could by CL or Nymex, etc) can adapt MPTM to their platform.

I then adapted PairsQty() to return the Pairs in the 3 strings:

Code: Select all

int BetPerQty(string betper)
{
   int i = 0;
   int j;
   int qty=0;
   
   while(i > -1)
      {
         i = StringFind(betper, ",",j);
         if (i > -1)
         {
            qty ++;
            j = i+1;            
         }
      }
      return(qty);
}
Finally adapted PFactor to cycle through these pairs, and set and return the correct factor

Code: Select all

double PFactor(string pair)
{
   double Pipfactor=10000;         // correct factor for most pairs

   string betper;
   int i = 0;int j = 0; int betperqty; int k; int pf = 0;

   for(int cycle = 0; cycle <3; cycle ++){
      switch(cycle){
         case 0: betper = BetPer1Pairs; pf = 1; break;
         case 1: betper = BetPer10thsPairs; pf = 10; break;
         case 2: betper = BetPer100thsPairs; pf = 100; break;
         default: break;
      }

      if (StringSubstr(betper, StringLen(betper)-1) != ",") betper = StringConcatenate(betper,",");

      betperqty = BetPerQty(betper);
      string pairs[]; 
      ArrayResize(pairs, betperqty - 1);
      
      i=0; j=0;

      for (k = 0; k < betperqty; k ++)
      {
         i = StringFind(betper, ",",j);
         if (i > -1)
         {
            pairs[k] = StringSubstr(betper, j,i-j);
            pairs[k] = StringTrimLeft(pairs[k]);
            pairs[k] = StringTrimRight(pairs[k]);
            j = i+1;         
         }
      }


      for (k = 0; k <= ArraySize(pairs); k ++)
      {
	     if (StringFind(pair,pairs[k],0) > -1){ 
		         Pipfactor = pf ;
               Print(Pipfactor);
               return (Pipfactor);
        }
      }
   }

   return (Pipfactor);
}
No doubt you'll be able to tidy up my diseased coding, but I need something like this to get MPTM to work correctly.

Art
Stochman
Posts: 3
Joined: Sun Jul 22, 2012 12:25 pm

Re: MPTM's new home

Post by Stochman »

What a fantastic job Art, a massive well done from me as I use the same criminal as yourself and can confirm that MPTM now works BEEEEEAUTIFULLY across the board, however I will say that after getting halfway through your post I did begin to wonder why the hell I was reading it as my forehead is obviously not of the required size :ugeek: :lol:

If it wasn't for you coding guys I would be completely stuffed regarding scripts, indies and EA's, so a MASSIVE and sincere thank you from me!
User avatar
SteveHopwood
Owner
Posts: 9904
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 »

HiArt99 wrote:Hi Steve,

being a hack coder, I tracked down the issue for commodities and Indices on MPTM.

The PFactor factor subroutine did not cater for them, and my criminal doesn't use the same code for Gold for example.

To address this I have added 3 external strings:

Code: Select all

extern string  BetPer1Pairs                  ="UK100,WS30,DAX30,NAS100,CAC40";
extern string  BetPer10thsPairs              ="GOLD,SP500";
extern string  BetPer100thsPairs             ="WTI,BRENT,SILVER,JPY";
Now I have been through my pairs and pressed F9 to open a trade. If it said "bet per 1" the pair stub went in my "BetPer1Pairs", and so on. I have done this so folks whose criminals use different names (WTI is crude for me, but it could by CL or Nymex, etc) can adapt MPTM to their platform.

I then adapted PairsQty() to return the Pairs in the 3 strings:

Code: Select all

int BetPerQty(string betper)
{
   int i = 0;
   int j;
   int qty=0;
   
   while(i > -1)
      {
         i = StringFind(betper, ",",j);
         if (i > -1)
         {
            qty ++;
            j = i+1;            
         }
      }
      return(qty);
}
Finally adapted PFactor to cycle through these pairs, and set and return the correct factor

Code: Select all

double PFactor(string pair)
{
   double Pipfactor=10000;         // correct factor for most pairs

   string betper;
   int i = 0;int j = 0; int betperqty; int k; int pf = 0;

   for(int cycle = 0; cycle <3; cycle ++){
      switch(cycle){
         case 0: betper = BetPer1Pairs; pf = 1; break;
         case 1: betper = BetPer10thsPairs; pf = 10; break;
         case 2: betper = BetPer100thsPairs; pf = 100; break;
         default: break;
      }

      if (StringSubstr(betper, StringLen(betper)-1) != ",") betper = StringConcatenate(betper,",");

      betperqty = BetPerQty(betper);
      string pairs[]; 
      ArrayResize(pairs, betperqty - 1);
      
      i=0; j=0;

      for (k = 0; k < betperqty; k ++)
      {
         i = StringFind(betper, ",",j);
         if (i > -1)
         {
            pairs[k] = StringSubstr(betper, j,i-j);
            pairs[k] = StringTrimLeft(pairs[k]);
            pairs[k] = StringTrimRight(pairs[k]);
            j = i+1;         
         }
      }


      for (k = 0; k <= ArraySize(pairs); k ++)
      {
	     if (StringFind(pair,pairs[k],0) > -1){ 
		         Pipfactor = pf ;
               Print(Pipfactor);
               return (Pipfactor);
        }
      }
   }

   return (Pipfactor);
}
No doubt you'll be able to tidy up my diseased coding, but I need something like this to get MPTM to work correctly.

Art
Thanks Art. Did you add this to the latest version from post 1? If you did, can you post it here, please, then I can put it into post 1 and it will save me a copy/paste job.

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. pianodoodler@hotmail.com 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.
godman
Trader
Posts: 14
Joined: Wed Aug 01, 2012 5:37 pm

Re: MPTM's new home

Post by godman »

Hi, I'm pretty new to MPTM. I've attached it to a chart and managing it by ticket number by setting ManageByTickeNumber to true

but the top left overlay that appears after the ea is enabled shows

Managing by: Ticket Number=0

I've read the doc and there's no mention that i will need to enter the ticket manually so i'm assuming that the ea will pick it up automatically, but that's not happening?

Please advise. Thanks.
godman
Trader
Posts: 14
Joined: Wed Aug 01, 2012 5:37 pm

Re: MPTM's new home

Post by godman »

Any example of how the new Close_LotsFract is applied?

There's a really good example in the doc which reads:

For example, suppose you have a 1 lot trade. You want:
● The jumping stop to move the sl every 20 pips profit.
● Lock in 2 pips profit at the first jump.
● 0.2 lots of the trade closed at each jump.
● 0.4 lots of the trade left on the table to follow the move until tp or a retrace hits your
stop.
These would be your settings:
● JumpingStop: true
● JumpingStopPips: 20
● AddBEP: true (and set AddBEP to 2 a little higher up)
● JumpAfterBreakevenOnly: false
● PartCloseEnabled: true
● Close_Lots: 0.2
● Preserve_Lots: 0.4

But from what i read, close_lots and preserve_lots are now combined into Close_LotsFract and honestly i'm not sure how this work.

An example appreciated :)

Thanks
shr1k
Posts: 7
Joined: Sat Jun 23, 2012 9:40 pm

Re: MPTM's new home

Post by shr1k »

I have been trying to modify the candle trail to use the high or low instead of the close. I am having a problem getting MPTM to detect if I am long or short on a pair.


if (UseCandlestickTrail)
{
if(long) cant figure this out
ClosePrice = NormalizeDouble(ilow(OrderSymbol(), CandlestickTrailTimeFrame, CandleShift), digits);
if (short) cant figure this out
ClosePrice = NormalizeDouble(ihigh(OrderSymbol(), CandlestickTrailTimeFrame, CandleShift), digits);

if (ClosePrice < OrderStopLoss())

can someone help me get this working in MPTM thanks
shr1k
Posts: 7
Joined: Sat Jun 23, 2012 9:40 pm

Re: MPTM's new home

Post by shr1k »

Code: Select all

 if (UseCandlestickTrail)
		   {
		   int updown = OrderType();
		      
		      if (updown == OP_BUY)
		       ClosePrice = NormalizeDouble(iLowOrderSymbol(), CandlestickTrailTimeFrame, CandleShift), digits);
		       else
		       //if (ClosePrice < OrderStopLoss())
		     
		       //if (updown == OP_SELL)
		       ClosePrice = NormalizeDouble(iHigh(OrderSymbol(), CandlestickTrailTimeFrame, CandleShift), digits);
		       if (ClosePrice < OrderStopLoss())
		       

this seems to work it sometimes is giving an order modify error when the high or low is to close to current price. for my use thats not an issue as the candle trail is not kicking in until after breakeven.
User avatar
spyderman
Trader
Posts: 338
Joined: Sun Dec 11, 2011 1:39 pm

Re: MPTM's new home

Post by spyderman »

I've been using the MPTM (4.29) for some time now. Excellent piece of work.
Thanks so much Steve.

I do have some strategies that employ moving averages and was wondering about adding a trail based on that.

I have another ea I use for MA trails but it doesn't have many of the other features (ticket number selection, partial closes, etc.) that the MPTM does.

Would that be a good add for this Steve...others?
Snaggin' some pips
Radar
Trader
Posts: 437
Joined: Fri Mar 23, 2012 5:39 pm
Location: Round the bend ;)

Re: MPTM's new home

Post by Radar »

Oh, man!

I just downloaded the current version of MPTM, and almost fell out of my chair!

I've been using MPTM for months, and it's been doing a great job, but, looking at it in winbloat exploder, it says...

Name: Multi purpose trade manager.mq4 Size: 29Kb Date Modified: 2/6/2008 4:04 PM

The latest version is 114Kb!!! My! How this baby has grown!

LOL

Radar =8^)
Check out my new, (well, old now), manual trade & automatic scale-in manager,
StackManV2
Locked

Return to “Utilities Indicators and Scripts”