Refresh Profit value on graph

 

Hi, I'm having difficulties with displaying the Profits value on screen.

What is happening at the moment is that when i run my script, the current Profit value is displayed on the graph (using Comment();), but then does not change its value as the Profit value displayed in the table (next to Swap).


The part of my code running this is:

while(true){

str = DoubleToStr(OrderProfit(),2);
Comment(str);

Sleep(2000);
RefreshRates();

}


So it basically displays the Profit value to the graph and then what i thought would happen is that after 2 seconds, it would refresh and display the new value of Profit (obviously if it has changed at this point)

Im not sure if I'm using RefreshRates(); correctly or if there is somthing I'm missing. Any input to the problem would be greatly appreciated!

Also, apologies if this problem has already been solved elsewhere, I did take the time to search for it in the forums, but to no avail.

Thanks, Adam.