Intelligent Take Profit considering Swap costs, not just pips!

 

Hello,

do you know any EA that is capable of managing lot of trades/orders at same time,
and close with profit the trades that have a predefined profit accumulated in deposit
currency ?

The profit, should be defined as money, let's say your account is in USD, then the
EA, could be set to close with profit trades that have profit >= $50, taking into
consideration the Swap, so, if a trade has let's say Swap $-10, the profit should be
$60, so the current profit + swap, would be matching the predefined smart take profit.


Let me know if anyone has seen similar tool around, or else, how this can be developed ?



PS: Please notice the EA to be able manage multiple trades, by looping all market orders
in the account it executes, independant of currency pair, magic number etc...

 
newbiefx:
The profit, should be defined as money, let's say your account is in USD, then the
EA, could be set to close with profit trades that have profit >= $50, taking into
consideration the Swap, so, if a trade has let's say Swap $-10, the profit should be
$60, so the current profit + swap, would be matching the predefined smart take profit.
#define Slippage.Pips 3
#define Close.USD     50
//++++ These are adjusted for 5 digit brokers.
double  pips2points,    // slippage  3 pips    3=points    30=points
        pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int init(){
    if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
}
ini start(){
    for(int pos = OrdersTotal()-1; pos >= 0 ; pos--) if (
        OrderSelect(pos, SELECT_BY_POS)                 // Only my orders w/
//  &&  OrderMagicNumber() == magic.number.last         // my magic number
    &&  OrderType()        <= OP_SELL
    &&  OrderSymbol()      == Symbol() ){               // and symbol
        if ( OrderProfit()+OrderSwap()+OrderCommission() >= Close.USD) 
           OrderClose( OrderTicket(), OrderLots(), OrderClosePrice(),
                                 Slippage.Pips*pips2points);
}   }
 
WHRoeder:

I have tried to use the code, but does not seem to work properly...

Do I do something wrong ? Is it ready to work, or need modifications on my end ?


PS: My balance is in EUR for broker, so I have changed this:

#define Close.EUR     50

not sure if that's the error ?

 
What you call your variables is irreverent as long as you change them all to match.
I have tried to use the code, but does not seem to work properly...
You say nothing. Figure it out. Think. Print statements. No slaves here.
Reason: