I have dumped the irrelevant functions and basket trading functions. Basket functions are dealt with elsewhere far better than MPTM ever did - details in the user guide.
This version's code is much clearer and so will be easier to add to. Coders, the notes pdf explains how.
Don't rush to put this on live accounts until you have tested test the features you want on demo first. There should not be bugs but you never know......................
I will consider requests for additional functionality they I think it might be useful to other members.
You do not have the required permissions to view the files attached to this post.
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.
Thanks Steve - for your continues updating/upgrading MPTM,it is so fine,especially descriptions inside code so that a person like me with zero coding knowledge can easily understand and learn things
attaching your latest "hgi_lib" that is updated till (HGI.expires Aprile 1st, 2018) just for to save users time finding it
from here http://www.stevehopwoodforex.com/phpBB3 ... 64#p105044
regards
mntiwana » Sun Dec 31, 2017 6:57 pm wrote:Thanks Steve - for your continues updating/upgrading MPTM,it is so fine,especially descriptions inside code so that a person like me with zero coding knowledge can easily understand and learn things
attaching your latest "hgi_lib" that is updated till (HGI.expires Aprile 1st, 2018) just for to save users time finding it
from here http://www.stevehopwoodforex.com/phpBB3 ... 64#p105044
regards
Thanks for trying to help.
I have deleted the library file from your post. Members have to get used to downloading it from Bob's thread because it is a date-limited file and there is only one place to find the latest working version.
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.
I have deleted the library file from your post. Members have to get used to downloading it from Bob's thread because it is a date-limited file and there is only one place to find the latest working version.
Thanks you too and happy new year 2018 -
Of course,you knows better how to handle forum matters
Would anybody be kind enough to check out if the part close function is working on their MPTM updated version please? No matter what I try it will not work here. I have used the old versions for a long while and they has always worked perfectly, so although I am as talented as a chimp wearing boxing gloves at coding I do know my way around the settings.
Thanks for any assistance on this one.
forexsiuk » Wed Jan 03, 2018 9:00 am wrote:Would anybody be kind enough to check out if the part close function is working on their MPTM updated version please? No matter what I try it will not work here. I have used the old versions for a long while and they has always worked perfectly, so although I am as talented as a chimp wearing boxing gloves at coding I do know my way around the settings.
Thanks for any assistance on this one.
The code is the same - a direct copy from the old version apart from my leaving out the error-trapping code. No idea why I did not include that.
Try the updated version with the error trapping code in post 1 or copy this over the top of the existing function:
bool PartCloseOrderFunction()
{
// Called when any attempt to part-close a long trade is needed.
// Trade has already been selected
// Returns 'true' if succeeds, else false.
bool result = CloseOrder(OrderTicket(), __FUNCTION__, Close_Lots, pcm );
if (result)
{
if (ShowAlerts==true) Alert("Partial close of ", OrderSymbol(), " ticket no ", OrderTicket());
return(true);
}//if (result)
else
{
int err=GetLastError();
if (ShowAlerts==true) Alert("Partial close of ", OrderSymbol(), " ticket no ", OrderTicket()," failed with error (",err,") : ",ErrorDescription(err));
Print("Partial close of ", OrderSymbol(), " ticket no ", OrderTicket()," failed with error (",err,") : ",ErrorDescription(err));
return(false);
}//else
}// End bool PartCloseOrderFunction()
This will tell us if there is a fault in the code.
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.
A trial with updated version on a demo account shows part-close is still not working. The BE and other functions work perfectly. No error messages are being generated.
Thank you for looking into this.
forexsiuk » Wed Jan 03, 2018 11:26 am wrote:A trial with updated version on a demo account shows part-close is still not working. The BE and other functions work perfectly. No error messages are being generated.
Thank you for looking into this.
That told me the part-close function function was not being called. It turns out I had forgotten to add the call to the break even code. Fixed in post 1, or copy this over the top of the existing void BreakEvenStopLoss(int ticket):
void BreakEvenStopLoss(int ticket)
{
// Move stop loss to breakeven
if (!BetterOrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
return;//Order has closed, so nothing to do.
//No need to continue if already at BE
if (OrderType() == OP_BUY)
if (OrderStopLoss() >= OrderOpenPrice() )
return;
if (OrderType() == OP_SELL)
if (!CloseEnough(OrderStopLoss(), 0) )//Sell stops need this extra conditional to cater for no stop loss trades
if (OrderStopLoss() <= OrderOpenPrice() )
return;
int err = 0;
bool modify = false;
double stop = 0;
//Can we move the stop loss to breakeven?
if (OrderType()==OP_BUY)
if (OrderStopLoss() < OrderOpenPrice() )
if (bid >= OrderOpenPrice() + (BreakEven / factor) )
if (OrderStopLoss() < OrderOpenPrice() )
{
modify = true;
stop = NormalizeDouble(OrderOpenPrice() + (BreakEvenProfit / factor), digits);
}//if (OrderStopLoss()<OrderOpenPrice())
if (OrderType()==OP_SELL)
if (OrderStopLoss() > OrderOpenPrice() || CloseEnough(OrderStopLoss(), 0) )
if (bid <= OrderOpenPrice() - (BreakEven / factor) )
{
modify = true;
stop = NormalizeDouble(OrderOpenPrice() - (BreakEvenProfit / factor), digits);
}//if (OrderStopLoss()>OrderOpenPrice())
//Modify the order stop loss if BE has been achieved
if (modify)
{
bool result = ModifyOrder(OrderTicket(), OrderOpenPrice(), stop, OrderTakeProfit(),
OrderExpiration(), clrNONE, __FUNCTION__, slm);
if (result)
{
if (UsePartClose && OrderLots() > Preserve_Lots)//Call the partial close function if enabled
{
bool PartCloseSuccess = PartCloseOrderFunction();
if (!PartCloseSuccess)
SetAGlobalTicketVariable();
}//if (PartCloseEnabled && OrderLots() > Preserve_Lots)
}//if (result)
}//if (modify)
}//End void BreakEvenStopLoss(int ticket)
Can you confirm that this works now, please?
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.