Backtest from the first bar of day
Author: gchudublin
Creation Date: 3/3/2017 7:09 PM
profile picture

gchudublin

#1
I am using the example strategy below to learn how to test

S&C 2017-04 | Volume-Weighted Moving Average Breakouts (Calhoun) by (Eugene)

I have 500 bar in the chart, but if I want to run back test and wanted to start from the 1st bar of today, how do I change this strategy to run back test of today's first bar? And I want to run in delayed fashion to simulate real time, ex run this every 10 seconds, so I can put debug information to the debug window. (Also I can write debug info to a local file right?)
profile picture

Eugene

#2
QUOTE:
I have 500 bar in the chart, but if I want to run back test and wanted to start from the 1st bar of today, how do I change this strategy to run back test of today's first bar?


There are different ways to do it, here are two that came to mind:

1. Simply choose "Most recent = 1 day(s)". Note that you will almost always have to use GetAllDataForSymbol in your script to avoid having WL reserve some (hundreds of) bars to build the DataSeries.

2. Add a condition to your code like:

CODE:
Please log in to see this code.


(On a related note. It's not possible to backtest from the first bar of today if an identic date is picked in the Date Range control. A data loading range must be at least 2 days in this case.)

QUOTE:
And I want to run in delayed fashion to simulate real time, ex run this every 10 seconds,

Market replay is not supported. Once this feature was being developed by me but the project never came to fruition due to a showstopper in WL itself.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).