MPTM's new home
-
osho619
- Posts: 2
- Joined: Thu Jun 13, 2013 9:59 am
Re: MPTM's new home
i put multi purpose trade manager ea in hotforex Empty4 but it is not attaching to that chart but i put another 4 digit broker Empty4 there this ea working ..
- milanese
- TechAdmin
- Posts: 3293
- Joined: Wed Jan 09, 2013 9:02 am
- Location: btr rdx, r8 +
Re: MPTM's new home
Then the problem seems broker specific.., so use brokers the EA is working withosho619 » Sat Jan 25, 2014 2:30 pm wrote:i put multi purpose trade manager ea in hotforex Empty4 but it is not attaching to that chart but i put another 4 digit broker Empty4 there this ea working ..
Cheers
Tommaso
Global Prime is the official SHF broker 
Searching for Servers and Workstations with individual configuration?
Just PM
Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
Searching for Servers and Workstations with individual configuration?
Just PM
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
-
dudest
- Trader
- Posts: 1847
- Joined: Tue May 08, 2012 2:37 pm
Re: MPTM's new home
And please put more info when reporting a problem ( e.g, experts log, journal log, any errors, MPTM version, etc ), we are not mind readers.osho619 » Sat Jan 25, 2014 5:30 pm wrote:i put multi purpose trade manager ea in hotforex Empty4 but it is not attaching to that chart but i put another 4 digit broker Empty4 there this ea working ..
I know for sure that MPTM works with HotForex ( and all other brokers I've tested stuff on, which are MANY ) and it works great. So it's most probably something to do with your setup.
Cheers
-
manoj_3986
- Trader
- Posts: 15
- Joined: Thu Mar 28, 2013 6:16 am
Re: MPTM's new home
Hi,
I have been using MPTM for JSL. It works perfectly fine for me. Now I want ea to put JSL after BE. I have make Add JSL after BE true but its not working as per my need.
BE=20 pips
JSL=30pips
Add JSL after BE= True
With above setting ea puts BE initially after 20 pips. There after jumping stop loss is kept at 30 pips only when price has moved 60 pips in favor. Where as I want JSL to be put once price moved 50 pips in favor. That would be 20 pips from the order price. There after ea should put JSL at 50 pips once price moved 80 pips in favor and so on.
Can Some body help me to modify the code as mentioned above ?
Thank you very much in advance.
Manoj
I have been using MPTM for JSL. It works perfectly fine for me. Now I want ea to put JSL after BE. I have make Add JSL after BE true but its not working as per my need.
BE=20 pips
JSL=30pips
Add JSL after BE= True
With above setting ea puts BE initially after 20 pips. There after jumping stop loss is kept at 30 pips only when price has moved 60 pips in favor. Where as I want JSL to be put once price moved 50 pips in favor. That would be 20 pips from the order price. There after ea should put JSL at 50 pips once price moved 80 pips in favor and so on.
Can Some body help me to modify the code as mentioned above ?
Thank you very much in advance.
Manoj
-
dudest
- Trader
- Posts: 1847
- Joined: Tue May 08, 2012 2:37 pm
Re: MPTM's new home
Hey Manoj!manoj_3986 » Wed Jan 29, 2014 9:22 am wrote:Hi,
I have been using MPTM for JSL. It works perfectly fine for me. Now I want ea to put JSL after BE. I have make Add JSL after BE true but its not working as per my need.
BE=20 pips
JSL=30pips
Add JSL after BE= True
With above setting ea puts BE initially after 20 pips. There after jumping stop loss is kept at 30 pips only when price has moved 60 pips in favor. Where as I want JSL to be put once price moved 50 pips in favor. That would be 20 pips from the order price. There after ea should put JSL at 50 pips once price moved 80 pips in favor and so on.
Can Some body help me to modify the code as mentioned above ?
Thank you very much in advance.
Manoj
The logic of what you're saying makes alot of sense, and the logic of what MPTM is doing is correct. By definition, JSL can't do what you're saying. So modifying the code won't help, because when price gets to +50pips, where would JumpingStop move SL to? If it was to move it to +30pips, then the logic is broken coz it's 20pips behind price and it's a 30-pip JSL [ donno if that makes sense ]
A workaround would be to use TrailingStopLoss [ + trail after BreakEven ].
TSL of 30pips (after BE) should work out that when price is +50pips, SL should be at +20
BE: 20
TSL: 30
Trail after break even: true
PS: the only code modification I can think of would be *specific to you*, and maybe better to do this directly in your EA instead of 'hacking' MPTM
Cheers
-
manoj_3986
- Trader
- Posts: 15
- Joined: Thu Mar 28, 2013 6:16 am
Re: MPTM's new home
Dear Dudest,
Thank you very much for your quick reply. As per my understanding if I use trailing stop then it will work as per following.
BE: 20
TSL: 30
Trail after break even: true
BE once price move 20 pips
TSL will be kept at 20 pips once price move 50 pips
TLS will be kept at 30 pips once price move 60 pips
TLS will be kept at 40 pips once price moved to 70 pips
But I want as per below
BE once price move 20 pips
SL will be kept at 20 pips once price move 50 pips
SL will be kept at 50 pips once price move 80 pips
SL will be kept at 80 pips once price moved to 110 pips
So that trade get some space to move on. Jump of JSL should be 30 but starting point would be not order price but market price at the time of BE.
I hope this can be done using modification of logic of JSL in two scenarios.
Senario 1- current MPTM is doing in case BE is > JSL
Senario 2- As I mentioned above in case BE is <JSL
Looking forward to receive you feedback.
Thanks
Manoj
Thank you very much for your quick reply. As per my understanding if I use trailing stop then it will work as per following.
BE: 20
TSL: 30
Trail after break even: true
BE once price move 20 pips
TSL will be kept at 20 pips once price move 50 pips
TLS will be kept at 30 pips once price move 60 pips
TLS will be kept at 40 pips once price moved to 70 pips
But I want as per below
BE once price move 20 pips
SL will be kept at 20 pips once price move 50 pips
SL will be kept at 50 pips once price move 80 pips
SL will be kept at 80 pips once price moved to 110 pips
So that trade get some space to move on. Jump of JSL should be 30 but starting point would be not order price but market price at the time of BE.
I hope this can be done using modification of logic of JSL in two scenarios.
Senario 1- current MPTM is doing in case BE is > JSL
Senario 2- As I mentioned above in case BE is <JSL
Looking forward to receive you feedback.
Thanks
Manoj
-
dudest
- Trader
- Posts: 1847
- Joined: Tue May 08, 2012 2:37 pm
Re: MPTM's new home
I get, you want to preserve the advantage of the JumpingStop, while making it act different on Jump #1.
Rather than hack at the MPTM JSL code ( harder than what follows next ), insert the below code into your EA and test if it compiles and works
Cheers
----------------------
Before "start()" function:
----------------------
Right before "start()" function ends:
----------------------
After "start()" fuction:
----------------------
Rather than hack at the MPTM JSL code ( harder than what follows next ), insert the below code into your EA and test if it compiles and works
Cheers
----------------------
Before "start()" function:
Code: Select all
extern double JS_BE = 20;
extern double JS_Pips = 30;
double PFactor = 10000;
Right before "start()" function ends:
Code: Select all
if (StringFind(Symbol(),"JPY",0) != -1){ PFactor = 100; }
if (StringFind(Symbol(),"XAU",0) != -1){ PFactor = 10; }
if (StringFind(Symbol(),"XAG",0) != -1){ PFactor = 100; }
JumpingStopLoss();
After "start()" fuction:
Code: Select all
void JumpingStopLoss()
{
for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
{
if (!OrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue;
if (OrderCloseTime() > 0) continue;
// Insert check here for to verify that we are acting on a trade opened by this EA
double sl=OrderStopLoss(); //Stop loss
if (OrderType()==OP_BUY)
{
// First check if sl needs setting to breakeven
if (sl==0 || sl<OrderOpenPrice())
{
if (Ask >= OrderOpenPrice() + (JS_BE /PFactor))
{
sl=OrderOpenPrice();
//sl=sl+(BreakEvenProfit /PFactor);
bool result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop set at breakeven : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask);
}//if (result)
if (!result)
{
int err=GetLastError();
Print(OrderSymbol(), " buy trade. Jumping stop function failed to set SL at breakeven, with error(",err);
}//if (!result)
}//if (Ask >= OrderOpenPrice() + (JumpingStopPips /PFactor))
} //close if (sl==0 || sl<OrderOpenPrice()
// First jump
if ( ( Ask >= ( ( JS_BE + JS_Pips ) /PFactor ) ) && ( sl >= OrderOpenPrice() ) && (sl < (OrderOpenPrice() + (JS_BE /PFactor) ) ) )
{
//sl=sl+(JumpingStopPips /PFactor);
sl = sl + (JS_BE /PFactor);
result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop: First Jump set : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask);
}//if (result)
if (!result)
{
err=GetLastError();
Print(OrderSymbol(), " buy trade. Jumping stop: Jump #1 failed with error(",err);
}//if (!result)
}// if (Ask >= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice())
// Future jumps
if ( (Ask >= sl + ((JS_Pips*2) /PFactor)) && (sl>= (OrderOpenPrice() + (JS_BE /PFactor) ) )
{
//sl=sl+(JumpingStopPips /PFactor);
sl = sl + (JS_Pips /PFactor);
result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop set : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask);
}//if (result)
if (!result)
{
err=GetLastError();
Print(OrderSymbol(), " buy trade. Jumping stop function failed with error(",err);
}//if (!result)
}// if (Ask >= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice())
}//if (OrderType()==OP_BUY)
if (OrderType()==OP_SELL)
{
// First check if sl needs setting to breakeven
if (sl==0 || sl>OrderOpenPrice())
{
if (Bid <= OrderOpenPrice() - (JS_BE /PFactor))
{
sl = OrderOpenPrice();
//sl=sl-(BreakEvenProfit /PFactor);
result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop set at breakeven : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid);
}//if(result)
if (!result)
{
err=GetLastError();
Print(OrderSymbol(), " sell trade. Jumping stop function failed to set SL at breakeven, with error(",err);
}//if (!result)
}//if (Ask <= OrderOpenPrice() - (JumpingStopPips /PFactor))
} // if (sl==0 || sl>OrderOpenPrice()
// First jump
if ( ( Bid <= ( ( JS_BE + JS_Pips ) /PFactor ) ) && ( sl <= OrderOpenPrice() ) && (sl > (OrderOpenPrice() + (JS_BE /PFactor) ) ) )
{
//sl=sl-(JumpingStopPips /PFactor);
sl = sl - (JS_BE /PFactor);
result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop: First Jump set : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid);
}
if (!result)
{
err=GetLastError();
Print(OrderSymbol(), " sell trade. Jumping stop function: First Jump failed with error(",err);
}//if (!result)
}//if (Bid>= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice())
// Future jumps
if ( (Bid <= sl - ((JS_Pips*2) /PFactor)) && (sl <= (OrderOpenPrice() + (JS_BE /PFactor) ) )
{
//sl=sl-(JumpingStopPips /PFactor);
sl = sl - (JS_Pips /PFactor);
result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE);
if (result)
{
Print("Jumping stop set : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid);
}
if (!result)
{
err=GetLastError();
Print(OrderSymbol(), " sell trade. Jumping stop function failed with error(",err);
}//if (!result)
}//if (Bid>= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice())
}//if (OrderType()==OP_SELL)
} //for
} //End of JumpingStopLoss sub
-
manoj_3986
- Trader
- Posts: 15
- Joined: Thu Mar 28, 2013 6:16 am
Re: MPTM's new home
Dear Dudest,dudest » Wed Jan 29, 2014 10:50 am wrote:I get, you want to preserve the advantage of the JumpingStop, while making it act different on Jump #1.
Rather than hack at the MPTM JSL code ( harder than what follows next ), insert the below code into your EA and test if it compiles and works
Cheers
----------------------
Before "start()" function:
----------------------Code: Select all
extern double JS_BE = 20; extern double JS_Pips = 30; double PFactor = 10000;
Right before "start()" function ends:
----------------------Code: Select all
if (StringFind(Symbol(),"JPY",0) != -1){ PFactor = 100; } if (StringFind(Symbol(),"XAU",0) != -1){ PFactor = 10; } if (StringFind(Symbol(),"XAG",0) != -1){ PFactor = 100; } JumpingStopLoss();
After "start()" fuction:
----------------------Code: Select all
void JumpingStopLoss() { for (int cc = OrdersTotal() - 1; cc >= 0; cc--) { if (!OrderSelect(cc, SELECT_BY_POS, MODE_TRADES) ) continue; if (OrderCloseTime() > 0) continue; // Insert check here for to verify that we are acting on a trade opened by this EA double sl=OrderStopLoss(); //Stop loss if (OrderType()==OP_BUY) { // First check if sl needs setting to breakeven if (sl==0 || sl<OrderOpenPrice()) { if (Ask >= OrderOpenPrice() + (JS_BE /PFactor)) { sl=OrderOpenPrice(); //sl=sl+(BreakEvenProfit /PFactor); bool result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop set at breakeven : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask); }//if (result) if (!result) { int err=GetLastError(); Print(OrderSymbol(), " buy trade. Jumping stop function failed to set SL at breakeven, with error(",err); }//if (!result) }//if (Ask >= OrderOpenPrice() + (JumpingStopPips /PFactor)) } //close if (sl==0 || sl<OrderOpenPrice() // First jump if ( ( Ask >= ( ( JS_BE + JS_Pips ) /PFactor ) ) && ( sl >= OrderOpenPrice() ) && (sl < (OrderOpenPrice() + (JS_BE /PFactor) ) ) ) { //sl=sl+(JumpingStopPips /PFactor); sl = sl + (JS_BE /PFactor); result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop: First Jump set : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask); }//if (result) if (!result) { err=GetLastError(); Print(OrderSymbol(), " buy trade. Jumping stop: Jump #1 failed with error(",err); }//if (!result) }// if (Ask >= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice()) // Future jumps if ( (Ask >= sl + ((JS_Pips*2) /PFactor)) && (sl>= (OrderOpenPrice() + (JS_BE /PFactor) ) ) { //sl=sl+(JumpingStopPips /PFactor); sl = sl + (JS_Pips /PFactor); result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop set : ", OrderSymbol(), " : SL ", sl, " : Ask ", Ask); }//if (result) if (!result) { err=GetLastError(); Print(OrderSymbol(), " buy trade. Jumping stop function failed with error(",err); }//if (!result) }// if (Ask >= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice()) }//if (OrderType()==OP_BUY) if (OrderType()==OP_SELL) { // First check if sl needs setting to breakeven if (sl==0 || sl>OrderOpenPrice()) { if (Bid <= OrderOpenPrice() - (JS_BE /PFactor)) { sl = OrderOpenPrice(); //sl=sl-(BreakEvenProfit /PFactor); result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop set at breakeven : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid); }//if(result) if (!result) { err=GetLastError(); Print(OrderSymbol(), " sell trade. Jumping stop function failed to set SL at breakeven, with error(",err); }//if (!result) }//if (Ask <= OrderOpenPrice() - (JumpingStopPips /PFactor)) } // if (sl==0 || sl>OrderOpenPrice() // First jump if ( ( Bid <= ( ( JS_BE + JS_Pips ) /PFactor ) ) && ( sl <= OrderOpenPrice() ) && (sl > (OrderOpenPrice() + (JS_BE /PFactor) ) ) ) { //sl=sl-(JumpingStopPips /PFactor); sl = sl - (JS_BE /PFactor); result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop: First Jump set : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid); } if (!result) { err=GetLastError(); Print(OrderSymbol(), " sell trade. Jumping stop function: First Jump failed with error(",err); }//if (!result) }//if (Bid>= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice()) // Future jumps if ( (Bid <= sl - ((JS_Pips*2) /PFactor)) && (sl <= (OrderOpenPrice() + (JS_BE /PFactor) ) ) { //sl=sl-(JumpingStopPips /PFactor); sl = sl - (JS_Pips /PFactor); result = OrderModify(OrderTicket(),OrderOpenPrice(),sl,OrderTakeProfit(),0,CLR_NONE); if (result) { Print("Jumping stop set : ", OrderSymbol(), " : SL ", sl, " : Bid ", Bid); } if (!result) { err=GetLastError(); Print(OrderSymbol(), " sell trade. Jumping stop function failed with error(",err); }//if (!result) }//if (Bid>= sl + (JumpingStopPips /PFactor) && sl>= OrderOpenPrice()) }//if (OrderType()==OP_SELL) } //for } //End of JumpingStopLoss sub
Thank you very much for your help.
I am getting error of '\end_of_program' - unbalanced left parenthesis.
Please find attached file.
Thank you very much for your help.
Thanks
Manoj
You do not have the required permissions to view the files attached to this post.
-
dudest
- Trader
- Posts: 1847
- Joined: Tue May 08, 2012 2:37 pm
Re: MPTM's new home
Hi Manoj,
I meant insert it into your EA, the one you're using to trade...
Or you're trading manually?
I meant insert it into your EA, the one you're using to trade...
Or you're trading manually?
-
manoj_3986
- Trader
- Posts: 15
- Joined: Thu Mar 28, 2013 6:16 am
Re: MPTM's new home
Hi,dudest » Wed Jan 29, 2014 1:37 pm wrote:Hi Manoj,
I meant insert it into your EA, the one you're using to trade...
Or you're trading manually?
I am using mptm to manage manual trade. I have added code as suggested but it is showing error as mentioned above.
Please suggest to resolve this error.
Thanks for your help.
Thanks
Manoj