stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

MPTM's new home
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=64
Page 11 of 57
Author:  wolfeman [ Tue Jul 24, 2012 9:42 pm ]
Post subject:  Re: MPTM's new home

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)
Author:  HiArt99 [ Thu Jul 26, 2012 2:18 pm ]
Post subject:  Re: MPTM's new home

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
Author:  Stochman [ Thu Jul 26, 2012 2:48 pm ]
Post subject:  Re: MPTM's new home

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!
Author:  SteveHopwood [ Fri Jul 27, 2012 10:34 pm ]
Post subject:  Re: MPTM's new home

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
Author:  godman [ Wed Aug 01, 2012 7:59 pm ]
Post subject:  Re: MPTM's new home

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.
Author:  godman [ Wed Aug 01, 2012 8:10 pm ]
Post subject:  Re: MPTM's new home

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
Author:  shr1k [ Thu Aug 02, 2012 1:21 pm ]
Post subject:  Re: MPTM's new home

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
Author:  shr1k [ Fri Aug 03, 2012 4:06 am ]
Post subject:  Re: MPTM's new home

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.
Author:  spyderman [ Tue Aug 14, 2012 2:39 pm ]
Post subject:  Re: MPTM's new home

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?
Author:  Radar [ Tue Aug 14, 2012 4:10 pm ]
Post subject:  Re: MPTM's new home

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^)
All times are UTC Page 11 of 57