Libraries: Equity Recorder - page 2

 
Great work! Is there any chance that you will alter the file to cope with the new HST file format?
 

I'd like to know if this is going to be updated also. I am using the library in indicator to create offline equity chart, but would like to call it from EA and it be able to do the same as when called from indicator and create and update chart. The big issue I have though is I'm using the updated version from author's website and if I'm not mistaken, it still creates the spike when MT4 restarted. Is there a way to fix this, or to at least go into offline chart history and correct the spike (of course if MT4 has to be shut down when spike is fixed, it will just create another one on restart). BTW, I use it to create offline equity chart from live trading or demo trading, not backtesting.

Thanks,

Don 

 

Here's a pic of what is happening. pen and Low for bar on MT4 restart are both 0.

Don 

 

I fixed the problem for myself by changing the following code:

if (t == time_current){
      // the bar has the current time, so update it
      if (price > h){
         h = price;
      }
      if (price < l){
         l = price;
      }
      c = price;
      v += volume;
      writeOfflineBar(symbol, period, 1, t, o, h, l, c, v);
   }else{
      // last bar is old, start a new one
      writeOfflineBar(symbol, period, 0, time_current, price, price, price, price, volume);
   }

 to this:

if (t == time_current){
      // the bar has the current time, so update it
      if(o == 0 || h == 0 || l == 0 || c == 0 || price == 0) return;
      if (price > h){
         h = price;
      }
      if (price < l){
         l = price;
      }
      c = price;
      v += volume;
      writeOfflineBar(symbol, period, 1, t, o, h, l, c, v);
   }else{
      // last bar is old, start a new one
      if(o == 0 || h == 0 || l == 0 || c == 0 || price == 0) return;
      writeOfflineBar(symbol, period, 0, time_current, price, price, price, price, volume);
   }

 You see that I inserted the following code twice:

if(o == 0 || h == 0 || l == 0 || c == 0 || price == 0) return;

Although by looking at the author's code none of these variables should be 0 by this time, they were, so returning (aka stopping) and waiting until next tick fixes the problem. Obviously on first tick the stuff doesn't get handled like it should.

Kindest regards,

Don 

Reason: