NexusFi: Find Your Edge


Home Menu

 




backtesting look ahead bias vs lag


Discussion in Traders Hideout

Updated
    1. trending_up 258 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 2 posts
    2. attach_file 1 attachments




Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now, It is Free
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.

-- Big Mike, Site Administrator

Available coupon codes for premium Elite Membership:
  • If you are a researcher and pay attention to details, you qualify for our 10% discount - "CHARTIST"
  • If you are a veteran or in public/community service, you qualify for 15% discount - "PURPLECHART"
  • If you are 60+ years old, you qualify for our 20% discount - "WISDOM"
  • Discounts are based on the honor system. If we can't trust you to do the right thing, please move along.

(If you already have an account, login at the top of the page)

 
Search this Thread

backtesting look ahead bias vs lag

(login for full post details)
  #1 (permalink)
 bp2012 
Pittsburgh, PA
 
Trading: Forex
Posts: 8 since Sep 2012
Thanks Given: 7
Thanks Received: 4

Hi,

Is anyone aware of a backtesting framework that supports multi-timeframes without either unnecessary lag by using the last complete bar or introducing look forward bias by using a complete bar that has data from the future?

For example, a backtest is iterating through 5m bars and is currently evaluating the bar at 03:45am. Any 5m indis would be calculated as of the close of that bar. But let's say you wanted to also evaluate against indis at a higher timeframe such as the 1 hour. Evaluating the prev complete 1hr bar (2am) would result in excluding action after 3am (unnecessary lag.) Using a complete 1h bar at 3am would include data from 03:50 through the end of the hour which doesn't yet exist at the end of the 03:45am bar (look forward bias.)

Ideally, any multi-tf indis would use a partially complete bar on the right side to simulate what we'd actually be seeing in real time if we went back to that point in time. So in this case it would be the incomplete 1h bar that is painted at the same time as the 3:45am 5m bar.

Hopefully this question makes sense.

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Strategy: second data series for using correct entry tim …
NinjaTrader
ninzaco snow eagle trading
NinjaTrader
RangeDisparityMeter Indicator for NT8
Platforms and Indicators
Time and Price Based Horizontal line Indicator - Request
NinjaTrader
Gabriel Grammatidis
Trading Reviews and Vendors
 

(login for full post details)
  #2 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Posts: 4,510 since Oct 2009
Thanks Given: 4,135
Thanks Received: 5,968


bp2012 View Post
Hi,

Is anyone aware of a backtesting framework that supports multi-timeframes without either unnecessary lag by using the last complete bar or introducing look forward bias by using a complete bar that has data from the future?

For example, a backtest is iterating through 5m bars and is currently evaluating the bar at 03:45am. Any 5m indis would be calculated as of the close of that bar. But let's say you wanted to also evaluate against indis at a higher timeframe such as the 1 hour. Evaluating the prev complete 1hr bar (2am) would result in excluding action after 3am (unnecessary lag.) Using a complete 1h bar at 3am would include data from 03:50 through the end of the hour which doesn't yet exist at the end of the 03:45am bar (look forward bias.)

Ideally, any multi-tf indis would use a partially complete bar on the right side to simulate what we'd actually be seeing in real time if we went back to that point in time. So in this case it would be the incomplete 1h bar that is painted at the same time as the 3:45am 5m bar.

Hopefully this question makes sense.

With Ninjatrader you can tell your indicator to get updated OnBarClose which means once at the close of the bar. OnEachTick means on every single tick. OnPriceChange means once for each price change. This way you can eliminate what you call unnecessary lag by using the last completed bar.

https://ninjatrader.com/support/helpGuides/nt8/calculate.htm

Here is a screen capture of the ES today 1 min chart using 2 EMA of the same length (20) where the large one is on bar close and the other on each tick. As you can see, there is no need for a multi-timeframe chart configuration.

Reply With Quote
The following 2 users say Thank You to trendisyourfriend for this post:
(login for full post details)
  #3 (permalink)
 bp2012 
Pittsburgh, PA
 
Trading: Forex
Posts: 8 since Sep 2012
Thanks Given: 7
Thanks Received: 4


Thanks very much for the response and especially the link to the help files. There is a section on dealing with multiple timeframes that talks about the Calculate.OnEachTick property.

It's not an exact fit for what I was searching for, but fairly close. It certainly beats having to code everything myself.

Started this thread Reply With Quote
The following user says Thank You to bp2012 for this post:





Last Updated on May 26, 2023


© 2023 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts