if((BuyProfit+SellProfit >= ProfitTarget) && CloseProfitableTradesOnly) CloseAllinProfit();
Hi, I'm testing this ea and I think it's very useful to close orders, but in my case I don't want to close all open orders, I just want to close only the profitable orders.
I've changed the "CloseProfitableTradesOnly" value from false to true, but orders keep closing at 1 usd. And what Im looking is to close only profitable orders when, together, reaches 25 usd. All closed orders above 1 usd of profit.
I guess you didn't write this code . . .
if(CloseAllNow) CloseAll(); if(CloseProfitableTradesOnly) CloseAllinProfit(); if(BuyProfit+SellProfit >= ProfitTarget) CloseAll(); if(ClosePendingOnly) ClosePendingOrdersOnly();
. . . but you should be able to read it.
You changed "CloseProfitableTradesOnly" value from false to true, so if you look above CloseAllinProfit() is called . . . regardless of the total profit.
Try this change:
if(CloseAllNow) CloseAll(); if(CloseProfitableTradesOnly && ProfitTarget == 0.0) CloseAllinProfit(); if(BuyProfit+SellProfit >= ProfitTarget && !CloseProfitableTradesOnly) CloseAll(); if(CloseProfitableTradesOnly && BuyProfit+SellProfit >= ProfitTarget) CloseAllinProfit(); if(ClosePendingOnly) ClosePendingOrdersOnly();
Hi Raptor, thanks for your answer.
I didn't write this code, I just change the "CloseProfitableTradesOnly" input value from false to true, like this:
I'm trying with your changes but still the ea doesn't close at profit target, (in this case 25 usd.)
Do I have to change from 0.0 to 25.0 in the code also?
if(CloseProfitableTradesOnly && ProfitTarget == 0.0) CloseAllinProfit();
Hi Raptor, thanks for your answer.
I didn't write this code, I just change the "CloseProfitableTradesOnly" input value from false to true, like this:
I'm trying with your changes but still the ea doesn't close at profit target, (in this case 25 usd.)
Do I have to change from 0.0 to 25.0 in the code also?
No, this line should be doing what you want, are you sure you made ALL the changes ?
if(CloseProfitableTradesOnly && BuyProfit+SellProfit >= ProfitTarget) CloseAllinProfit();
if(CloseAllNow) CloseAll(); if(CloseProfitableTradesOnly) CloseAllinProfit(); if(BuyProfit+SellProfit >= ProfitTarget) CloseAll(); if(ClosePendingOnly) ClosePendingOrdersOnly();
To this:
if(CloseAllNow) CloseAll(); if(CloseProfitableTradesOnly && ProfitTarget == 0.0) CloseAllinProfit(); if(BuyProfit+SellProfit >= ProfitTarget && !CloseProfitableTradesOnly) CloseAll(); if(CloseProfitableTradesOnly && BuyProfit+SellProfit >= ProfitTarget) CloseAllinProfit(); if(ClosePendingOnly) ClosePendingOrdersOnly();
And the input "CloseProfitableTradesOnly" from false, to true.
But don't close. What else could it be?
I've changed from this
To this:
And the input "CloseProfitableTradesOnly" from false, to true.
But don't close. What else could it be?
Perhaps your total profit is less than 25.0
If was less than 25, then should close even faster.
If was less than 25, then should close even faster.
No, the profit has to be greater than or equal to 25.0 before it will close . . .
if(CloseProfitableTradesOnly && BuyProfit+SellProfit >= ProfitTarget) CloseAllinProfit();
No, the profit has to be greater than or equal to 25.0 before it will close . . .
Here is an example Raptor. I have 4 orders with 97.9 of profit. So If my profit target is 25, and the condition is "CloseProfitableTradesOnly" true, then these 4 orders should close. But is not closing any order.
Here is an example Raptor. I have 4 orders with 97.9 of profit. So If my profit target is 25, and the condition is "CloseProfitableTradesOnly" true, then these 4 orders should close. But is not closing any order.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I'm testing this ea and I think it's very useful to close orders, but in my case I don't want to close all open orders, I just want to close only the profitable orders.
I've changed the "CloseProfitableTradesOnly" value from false to true, but orders keep closing at 1 usd. And what Im looking is to close only profitable orders when, together, reaches 25 usd. All closed orders above 1 usd of profit.
If have any suggestion I really appreciate it. Thanks in advance for your help.
Here is the ea and code: