i try to find the way to defined the special Take Profit for my expert that i started to write it. your text was useful for me but i could not correct mine, so , if it is possible to you , please guide me. my TP plane is: when set the for example Buy in chart and it go in right way and profit, TP value move to maximum profit point, so when the trend turn change the straight to down way , TP value placed in 70 percent of maximum profit. below cod is the code which i write. please let me know m wrongs and help me to correct them.
for(int i=0;i<total;i++)
{
/****** NEW LINE **************/PositionSelectByTicket(position_ticket);
/****** NEW LINE **************/
tp_request.comment="TP"+IntegerToString(i)+"_"+IntegerToString(position_ticket);
if(i_TakeProfit.At(i)<tp_int && d_TakeProfit.At(i)>0)
Good afternoon @Dmitriy Gizlyk, Could you help with this problem? I've tried a lot of things but I can't get out of this error. If you can help, thank you.
Can you help me please? I don't know how to programme etc. I just wanted my profit to be plotted as a limited order (if you could describe how to use your file I would be very grateful).
FalconGhost2 : Can you help me please? I don't know how to programme etc. I just wanted my profit to be plotted as a limit order (if you could describe how to use your file I would be very grateful).
Hi, You can't use this file if you use manual trading. It is for use in EA.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi dear
i try to find the way to defined the special Take Profit for my expert that i started to write it. your text was useful for me but i could not correct mine, so , if it is possible to you , please guide me. my TP plane is: when set the for example Buy in chart and it go in right way and profit, TP value move to maximum profit point, so when the trend turn change the straight to down way , TP value placed in 70 percent of maximum profit. below cod is the code which i write. please let me know m wrongs and help me to correct them.
double BuyPipsProfit,SellPipsProfit,BuyProfitLevel,SellProfitLevel;
double TP_Buy=0;
double TP_Sell=0;
for(int i=OrdersTotal()-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
BuyPipsProfit= Ask-(double)OrderOpenPrice() ;
SellPipsProfit= (double)OrderOpenPrice()-Bid;
BuyProfitLevel= BuyPipsProfit*.7;
SellProfitLevel= SellPipsProfit*.7;
TP_Buy = (50*Point)+ ((OrderOpenPrice()+ BuyProfitLevel)*Point);
TP_Sell= (50*Point)+ ((OrderOpenPrice()+ SellProfitLevel)*Point);
}
}
Hello,
Don't work.
LimitTakeProfit.mqh error:
Thank you.
@MetaQuotes, thanks for this code!
I have found a bug in this function and give my humble solution:
If we have 2 TP and the first one have been closed, the second one will be WRONG closed here:
Why? Because when searching for the first TP in this function:
We change the selected position, so, in the loop:
We use the wrong position to evaluate second TP here:
Causing the second TP to be closed! My fix is:
Thanks again!
Did you use the original code or did you add the code to your advisor?
I've never made it work.
Good afternoon @Dmitriy Gizlyk, Could you help with this problem? I've tried a lot of things but I can't get out of this error. If you can help, thank you.
Hi, You can't use this file if you use manual trading. It is for use in EA.
Regards, Dmitry.
Thanks for replying Dmitriy! Do you know if there is another way to do manual trading?