PureBytes Links
Trading Reference Links
|
>
>At 06:32 AM 1/5/2005, Adrian Pitt wrote:
>
>>Can anyone offer any suggestions here please? In summary, I want to know
>>if the next trading bar to appear on the chart will be in a new month
>>compared to the most recent bar on the chart. Obviously its apparent in
>>real time, but for backtesting I can't find a way.
This could be ugly, but brute force could work here.
Just build a function to include in your backtest strategy
LastDayOfMonth code would go something like this
----------------------
LastDayOfMonth = false;
if D = 1040131 or
D = 1040228 or
D = 1040330 or
D = 1040430 then LastDayOfMonth = true;
---------------------------
Just keep adding dates for last day of month in the conditions. Make sure you put in the real last trading day of the month, not just final day as in the examples above. Do your full history once to have it for any backtest. Update it once a month to keep it current.
You could speed it up by splitting it into years, and avoid testing against every month every single time.
Hope that helps,
Mike Gossland
|