I'm working on a function which logs and plots the monthly profit during testing.

I'm using the for(all_trades) loop to get the informations from closed trades. To get year and month from the trade i use year(TradeBarClose) and month(TradeBarClose).

The problem is that year and month doesn't correspond to the real close date. It gives me completely different values. The result is someway shifted backwards.

I have attached the source file. It can be included from any script.

Attached Files
profile_profit.zip (4 downloads)