Problems with PositionTotal()

 

This is my code and i want to know if PositionTotal() always return 0

#include <Trade\SymbolInfo.mqh>

CSymbolInfo symbol;

double ask,puntos,resultado,porcentaje,TotalPuntosGerenciamiento;
int i;


int OnInit()
  {
   
   //Comment(symbol.Ask());
   return(INIT_SUCCEEDED);
  }

void OnDeinit(const int reason)
  {
   
    
  }

void OnTick()
  {
   ask=SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   puntos=SymbolInfoDouble(_Symbol,SYMBOL_POINT);
   resultado=ask/puntos;
   porcentaje=resultado/100;
   TotalPuntosGerenciamiento=porcentaje*50;//por lo que divido es el riesgo que asumo, en NewEdge es 50
   i=PositionsTotal();
  
   
   
   
   
   
   
   
   Comment("ASK: ",ask,
      "\n Puntos o Tick o PIP: ",puntos,
      "\n ASK/Puntos: ",resultado,
      "\n En porcentaje(?): ",porcentaje,
      "\n PuntosGerenciamiento: ",TotalPuntosGerenciamiento,
      "\n Posiciones: ",i);
   
  }

Thanks in advance


Ariel P.

 

Yes, always. The main thing is not to confuse the concept of POSITION and PENDED ORDER.

That is, PositionTotal () shows the positions that are open at the moment.

 
Vladimir Karputov:

Yes, always. The main thing is not to confuse the concept of POSITION and PENDED ORDER.

That is, PositionTotal () shows the positions that are open at the moment.

oh, that's my confusion, sure. Do you know where should i read for make that statement more clear to me?

thank's

 
5ariel_92 :

oh, that's my confusion, sure. Do you know where should i read for make that statement more clear to me?

thank's

Read the reference documentation: PositionsTotal

Documentation on MQL5: Trade Functions / PositionsTotal
Documentation on MQL5: Trade Functions / PositionsTotal
  • www.mql5.com
PositionsTotal - Trade Functions - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov:

Read the reference documentation: PositionsTotal

i red before but i didn't understand quite well