MPTM's new home

MPTM's new home
Locked
kelisa
Trader
Posts: 188
Joined: Sun Mar 04, 2012 6:51 am

Re: MPTM's new home

Post by kelisa »

Read every post on this thread. I ve been wanting to see if anyone post their tuned settings for EU or any other pairs, but I also understand that everyone's entry point for a trade is different and with different crims, the setting varies greatly. So, I conclude that, everyone, newbie or experience traders who want to use this EA, you just have to make use of whats available within this EA, which is more than sufficient. No need to request any other variations to be implemented.
If your strategy is working well, dont be GREEDY and change it!
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 »

pgtips wrote:Dare I offer an alternative I have found (still to resolve 3 problems of 5 digit criminal, preserve lots and it only works on full lot size, not mini) but it does get around multiple instances of code running and using shared variable.

I wonder Steve if I might have permission to play around and maybe borrow some of your code. I have no idea where to start but I'll give it a go.

Code: Select all

//+--------------------------------------------------------+
//|                  e-Smart_Tralling                      |
//+--------------------------------------------------------+

extern   bool     UseOneAccount = true;
extern   bool     UseCloseOneThird = true;
extern   int      LevelProfit1 = 30;
extern   int      LevelMoving1 = 10;
extern   int      LevelProfit2 = 15;
extern   int      LevelMoving2 = 10;
extern   int      LevelProfit3 = 25;
extern   int      LevelMoving3 = 15;
extern   int      TrailingStop = 30;
extern   int      TrailingStep = 5;
extern   int      Slippage = 2;
extern   bool     ShowComment = true;
extern   bool     UseSound = true;
string   var_132 = "expert.wav";

//+------------------------------------------------------------------+

void deinit()
{
Comment("");
}

//+------------------------------------------------------------------+

void start()
{
double point;
int    digits;
string msg = "";

for (int i = 0; i < OrdersTotal(); i++)
   {
   if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
      {
      if (UseOneAccount || (OrderSymbol() == Symbol()))
         {
         ThreeLevelSystemOfOutput();
         digits = MarketInfo(OrderSymbol(),MODE_DIGITS);
         point = MarketInfo(OrderSymbol(),MODE_POINT);
         msg = msg + OrderSymbol() + "  Öåíà: " + DoubleToStr(OrderOpenPrice(),digits) + "  SL = " + DoubleToStr(OrderStopLoss(),digits) + " (" + StopLossInPoint() + ")\n";
         }
      }
   }

if (ShowComment) Comment(msg);
}

//+------------------------------------------------------------------+

void ThreeLevelSystemOfOutput()
{
int profit = ProfitPosition();
int sl = StopLossInPoint();
int spread = MarketInfo(OrderSymbol(),MODE_SPREAD);

if ((profit > LevelProfit1) && (profit <= LevelProfit2) && (sl < LevelMoving1))
   {
   ModifyStopLossInPoint(LevelMoving1);
   if (UseCloseOneThird) CloseOneThird();
   }
if ((profit > LevelProfit2) && (profit <= LevelProfit3) && (sl < LevelMoving2)) ModifyStopLossInPoint(LevelMoving2);
if ((profit > LevelProfit3) && (sl < LevelMoving3)) ModifyStopLossInPoint(LevelMoving3);
if (profit > LevelMoving3 + TrailingStop + TrailingStep) TrailingPositions();
}

//+------------------------------------------------------------------+

void CloseOneThird()
{
bool   result = false;
double lots = MathCeil(OrderLots() / 3.0 * 10.0) / 10.0;

if (lots > 0.0)
   {
   if (OrderType() == OP_BUY)
      {
      result = OrderClose(OrderTicket(),lots,Bid,Slippage,CLR_NONE);
      }
   if (OrderType() == OP_SELL)
      {
      result = OrderClose(OrderTicket(),lots,Ask,Slippage,CLR_NONE);
      }
   if (result && UseSound) PlaySound(var_132);
   }
}

//+------------------------------------------------------------------+

void TrailingPositions()
{
double bid;
double ask;
double point = MarketInfo(OrderSymbol(),MODE_POINT);

if (OrderType() == OP_BUY)
   {
   bid = MarketInfo(OrderSymbol(),MODE_BID);
   if (bid - OrderOpenPrice() > TrailingStop * point)
      {
      if (OrderStopLoss() < bid - (TrailingStop + TrailingStep - 1) * point)
         {
         ModifyStopLoss(bid - TrailingStop * point);
         return;
         }
      }
   }

if (OrderType() == OP_SELL)
   {
   ask = MarketInfo(OrderSymbol(),MODE_ASK);
   if (OrderOpenPrice() - ask > TrailingStop * point)
      {
      if ((OrderStopLoss() > ask + (TrailingStop + TrailingStep - 1) * point) || (OrderStopLoss() == 0))
         {
         ModifyStopLoss(ask + TrailingStop * point);
         }
      }
   }
}

//+------------------------------------------------------------------+

void ModifyStopLoss(double sl)
{
bool result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result && UseSound) PlaySound(var_132);
}

//+------------------------------------------------------------------+

void ModifyStopLossInPoint(int stoploss)
{
bool   result;
double sl = 0;
double point = MarketInfo(OrderSymbol(),MODE_POINT);

if (OrderType() == OP_BUY) sl = OrderOpenPrice() + stoploss * point;
if (OrderType() == OP_SELL) sl = OrderOpenPrice() - stoploss * point;

result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result && UseSound) PlaySound(var_132);
}

//+------------------------------------------------------------------+

int ProfitPosition()
{
double bid;
double ask;
double point = MarketInfo(OrderSymbol(),MODE_POINT);
double profit = 0;

if (OrderType() == OP_BUY)
   {
   bid = MarketInfo(OrderSymbol(),MODE_BID);
   profit = (bid - OrderOpenPrice()) / point;
   }
if (OrderType() == OP_SELL)
   {
   ask = MarketInfo(OrderSymbol(),MODE_ASK);
   profit = (OrderOpenPrice() - ask) / point;
   }
return(MathRound(profit));
}

//+------------------------------------------------------------------+

int StopLossInPoint()
{
double point = MarketInfo(OrderSymbol(),MODE_POINT);
double sl = 0;

if (OrderType() == OP_BUY) sl = (OrderStopLoss() - OrderOpenPrice()) / point;
if (OrderType() == OP_SELL) sl = (OrderOpenPrice() - OrderStopLoss()) / point;
if (OrderStopLoss() == 0.0) sl = -OrderOpenPrice() / point;
return(MathRound(sl));
}
Kevin
My code is open-source and free for everyone to adapt to their own uses. In fact, my work is usually a composite that includes contributions by others, and mptm is no exception.

Have fun.

: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.
GilR
Posts: 1
Joined: Sat Jun 09, 2012 1:47 pm

Re: MPTM's new home

Post by GilR »

Hi

I must be doing something wrong --- The read out of left top just blinks

What setting would I use for

SL=8pips
TP=6pips
Trailing stop 8pips

So if price moves in my favor 5pips my stop has moved to -3 pips

Thanks

Gil
Jagg

Re: MPTM's new home

Post by Jagg »

Also wondering if it's possible to that with MPTM:

- order two pips of symbol xy
- both should get a stop loss of e.g. 60 pips
- BE should be set to 60 (+5 pips)
- when +60 is reached half the position should be exited and the rest stay in as a "runner" with jumping stop loss active.

possible?!

(and also a question of using mptm with non forex pairs like FDAX. It has 0.5 as tick value. Is this a problem?)
daveM
Trader
Posts: 34
Joined: Sun Jun 10, 2012 3:52 pm
Location: Toronto

Re: MPTM's new home

Post by daveM »

I am using MPTM on a small basket and it is doing a wonderful job (according to me......).

Jumping Stop is a heading that I have not seen info on.

Would someone point me to some documentation on that feature please..

Thanks for your help.

daveM
garyfritz

Re: MPTM's new home

Post by garyfritz »

See p. 3 of the manual.
User avatar
getting
Trader
Posts: 26
Joined: Tue May 01, 2012 3:27 pm
Location: Thailand

Re: MPTM's new home

Post by getting »

someone please show me how to modified MPTM to Hedge different pair, rather than hedging the same pair. :idea:
Image
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 »

getting wrote:someone please show me how to modified MPTM to Hedge different pair, rather than hedging the same pair. :idea:
Good luck if you try to get into that, my friend. Your best bet is to look at the conditions that will trigger a same-pair hedge, then replace the pair with the pair you want to use as a hedge.

Yurk, is all I can say about looking into that, but if you bugger up the code you can always re-download and start again.

I hope you manage what you want to achieve.

: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.
tonycashflow
Posts: 3
Joined: Mon May 28, 2012 2:03 am

Re: MPTM's new home

Post by tonycashflow »

Hi everyone,

I was wondering if it was possible to add the TradeExpiry setting like in the Basket section, but for individual trades.

Thanks ;)
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 »

Latest update in post 1.

From post 1:
All our thanks go to Lifesys - Paul. Paul has adapted all the previous pips/point stuff that emerged a couple of weeks ago. He has also adapted the part-close code to simply close Close_LotsFract percent of a trade at each closure point, so no need any more to specify Close_Lots and Preserve_Lots. Thanks Paul. You are a star.


: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.
Locked

Return to “Utilities Indicators and Scripts”