Code Not Working

 

This is a work in process. I am writing pieces of the code and then testing.   

The following code is supposed to print the the most profit achieved and the largest loss achieved on the screen.  I have watched the results and sometimes it will miss an update. I do not understand why.  

Thank you for your help... 

Files:
 
dukeb:

This is a work in process. I am writing pieces of the code and then testing.   

The following code is supposed to print the the most profit achieved and the largest loss achieved on the screen.  I have watched the results and sometimes it will miss an update. I do not understand why.  

Thank you for your help... 

 


m_intTotOrders=OrdersTotal();

It is not always true  change after start 

if(OrdersTotal() != m_intTotOrders)m_intTotOrders = OrdersTotal();

you have to remove comment deinitializing "EA"

forget 

int deinit()
  {
//----
   Comment("");
   
//----
   return(0);
  }

Print out value 2 Digits

change comment to

Comment("High = " + DoubleToStr(m_dblHi,2) + "   "  + "Low = " + DoubleToStr(m_dblLo,2));
 
deVries:

It is not always true  change after start 

you have to remove comment deinitializing "EA"

forget 

Print out value 2 Digits

change comment to

 

 

 

Thank you very much.  Assuming I do not place new orders-- why is this not always true (m_intTotOrders=OrdersTotal();)?
 
dukeb:
Thank you very much.  Assuming I do not place new orders-- why is this not always true (m_intTotOrders=OrdersTotal();)?

not only with placing new trades

the moment a sl or tp is hit it will change also

or when you close manually a trade OrdersTotal() is changing

only at starting in init you make ==>    m_intTotOrders=OrdersTotal()

 
deVries:

not only with placing new trades

the moment a sl or tp is hit it will change also

or when you close manually a trade OrdersTotal() is changing

only at starting in init you make ==>    m_intTotOrders=OrdersTotal()

 

Very good point --- thank you for your help..
Reason: