Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1083

 

I'm trying to modify the position, but it's not working.

Can you tell me what's wrong?

void OM(long const magic_number)
  {
   Print(__FUNCTION__);
   for(int i=PositionsTotal()-1;i>=0;i--) // returns the number of open positions
      if(m_position.SelectByIndex(i))
         if( m_position.Magic()==magic)
            m_trade.PositionModify(m_position.Ticket(),SymbolInfoDouble(Symbol(),SYMBOL_BID)-1000*Point(),SymbolInfoDouble(Symbol(),SYMBOL_BID)+1000*Point());         
   return;
  } 
 
tabacmaker:

I'm trying to modify the position, but it's not working.

Can you tell me what's wrong?

You don't specify what type of position: BUY or SELL - but they have the opposite principle of Stop Loss and Take Profit

 
Vladimir Karputov:

You don't define what type of position: BUY or SELL - and they have exactly the opposite principle of setting Stop Loss and Take Profit

only BUY or SELL positions are opened
 
Vladimir Karputov:

You don't define what type of position: BUY or SELL - and they have exactly the opposite principle of setting Stop Loss and Take Profit

Deal is modified by 1 pip only, though I putSymbolInfoDouble(Symbol(),SYMBOL_BID)-1000*Point()
 
tabacmaker:
The deal is modified by 1 pip only, although I set SymbolInfoDouble(Symbol(),SYMBOL_BID)-1000*Point()

Forum on Trading, Automated Trading Systems and Strategy Tests

FAQ from Beginners MQL5 MT5 MetaTrader 5

Vladimir Karputov, 2019.07.03 05:23

You don't define the position type: BUY or SELL - and they have the opposite principles of Stop Loss and Take Profit


After position allocation you need to define its type - for example for BUY

            if(m_position.PositionType()==POSITION_TYPE_BUY)

and only then try to set Stop Loss and Take Profit for it. Stop Loss and Take Profit should not be set "from the ceiling": you should analyzethe opening price of the position and the current price of the position. You cannot just take the current Ask and Bid price out of the blue.

 
Good day ! Are there plans to make separate trades in MT5 like in MT4 ? Without combining.
 
sbr080:
Afternoon ! Is it planned to make separate trades in MT5 like in MT4 ? Without combining.

planned, planned release date 2016.03.25 :)

 
sbr080:
Good day ! Are there plans to make separate trades in MT5 like in MT4 ? Without combining.
It's been three years now...
 
sbr080:
Good day ! Do you plan to create in MT5 separate trades like in MT4 ? Without combining.

In MetaTrader 5 it has been possible to open two types of trading accounts for several years:

  • Netting - only one position (either BUY or SELL) can be opened at a time. A BUY 0.5 lot was opened and became BUY 1.5 lot.
  • Hedge - several opposite positions can exist on one symbol at the same time: e.g. BUY 1.3 lot and SELL 0.8 lot.

 
Vladimir Karputov:

In MetaTrader 5 it has been possible to open two types of trading accounts for several years:

  • Netting - only one position (either BUY or SELL) can be opened at a time. A BUY 0.5 lot was opened and became BUY 1.5 lot.
  • Hedge - several opposite positions can exist on one symbol at the same time: e.g. BUY 1.3 lot and SELL 0.8 lot.

In a hedge it is possible to open several positions: e.g. BUY 1 lot and BUY 2 lots at different prices without combining ?