is there a function where we can get the value of stoploss and takeProfit

 

Hello ;

for example for the profit : we use :

AccountProfit();

but I don't know ho to get the level of stop Loss and Take Profit ??

thanks

 
https://docs.mql4.com/trading OrderSelect() then OrderStopLoss()
    for(int iPos = OrdersTotal()-1; iPos >= 0 ; iPos--) if (
        OrderSelect(iPos, SELECT_BY_POS)                // Only my orders w/
    &&  OrderMagicNumber()  == magic.number             // my magic number
    &&  OrderSymbol()       == Symbol()                 // and my pair.
    ){
        :
 

Hello ;

thank you but I would like for example to get the value of stop loss on the current chart like (EUR/USD) . if we suppose that there are a lot of order how to get the value of stoploss of the current chart that we see

I try to make a code like this


if(OrderSelect(???,SELECT_BY_POS)==true)

      {
    
  
     etatstop= CreerObjet("label_stop",OrderStopLoss(),339,1,Red);
     
            if ( etatstop==0)
          {
               Print("error: can't create label_object! code #",GetLastError());
    
          }
    
    }

and I don't know about the index that we put in OrderSelect .

I mean is it possible to get just the value of stoploss of the current chart for example like Moving average

when we write

iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,i);

with NULL and 0 as a parameter it shows for all currecies and all time frame

 
for(...)
if (OrderSymbol() == Symbol()) //only your symbol
 
WHRoeder:
https://docs.mql4.com/trading OrderSelect() then OrderStopLoss()

thanks I understand your code
Reason: