Download MetaTrader 5

TakeProfit adjustment

To add comments, please log in or register
Tony Chavez
236
Tony Chavez  

I am noticing when new orders are open on the same pair that the TakeProfit point for all orders are adjusted to the same point causing some orders to takeprofit at a loss.


So how would I get what the current take profit point is for a certain open pair? That way I could evaluated it verse what the new orders take profit point should be and adjust the takeprofit for the pair to which ever is greater.

Keith Watford
Moderator
10645
Keith Watford  
Tony Chavez:

I am noticing when new orders are open on the same pair that the TakeProfit point for all orders are adjusted to the same point causing some orders to takeprofit at a loss.


So how would I get what the current take profit point is for a certain open pair? That way I could evaluated it verse what the new orders take profit point should be and adjust the takeprofit for the pair to which ever is greater.

Maybe you are suffering from FIFO?
Tony Chavez
236
Tony Chavez  
Both things are an issue. Just the takeprofit portion seems manageable where FIFO I am just stuck with.
Keith Watford
Moderator
10645
Keith Watford  

FIFO is a completely stupid rule as far as I am concerned. What difference does it make which are closed first? Just bureaucratic nonsense.

If you are trading manually, there is not much you can do unless they are all the same lot size and you could swap the TPs.

If with an EA, it would require some coding to make sure that the first opened will be the first closed.

Tony Chavez
236
Tony Chavez  
Keith Watford:

FIFO is a completely stupid rule as far as I am concerned. What difference does it make which are closed first? Just bureaucratic nonsense.

If you are trading manually, there is not much you can do unless they are all the same lot size and you could swap the TPs.

If with an EA, it would require some coding to make sure that the first opened will be the first closed.

I am writing an EA and in the end I will have it do something like this. Code is for logic purpose only not actual working code.


double CurrentTP = CheckOpenOrdersTP(Symbol){

if(CurrentTP >= NewTP){

TP = CurrentTP;

} else{

TP = NewTP;

}

Tony Chavez
236
Tony Chavez  
Anyone have any thoughts on who to get the current TakeProfit point for a pair?
whroeder1
15934
whroeder1  
Tony Chavez: Anyone have any thoughts on who to get the current TakeProfit point for a pair?
  1. Not who, how.
  2. It's called an OrderSelect loop.
  3. Don't double post
  4. Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.) Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forum
To add comments, please log in or register