unknown retcode 0 while modifying position

 

Hi, could someone help me?

 I'm trying to write a code to modify a position with up and down buttons. The button are correctly working but the attempt to modify the position ends in unknown retcode 0. Here's the code

for(int i = PositionsTotal() - 1; i >= 0; i--) // loop all Open Positions
{
   if(m_position.SelectByIndex(i))  // select a position
   {    
      switch(lparam)
      {
         case KEY_UP:     m_trade.PositionModify(m_position.Ticket(), m_position.StopLoss() + 0.50, m_position.TakeProfit());   break;
         case KEY_DOWN:   m_trade.PositionModify(m_position.Ticket(), m_position.StopLoss() - 0.50, m_position.TakeProfit());   break;    
      }
   }
}       
 
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
 
Fernando Carreiro #:
Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Ok. sorry
 
I slept and relized I was trying that in an indicator insteat EA, LOL. A good day everybody!