RightEdge Forums
Main     Home          Members     Calendar     Who's On

Welcome Guest
        



Look Ahead Bias in RE? Expand / Collapse
Message
Posted 2/11/2010 23:25:27 Post #10829
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
I'm evaluating RE at the moment to see if a switch from WealthLab is worthwhile for me. In WL you really have to be extremely
careful to avoid Look Ahead Bias when developing your systems since all prices, even future ones, are available at all times.
Since this is such a devastating error, you have to develop an eagle eye for spotting these mistakes when developing systems,
and I'm intrigued by RE's event driven model that seems to limit the possibility for look ahead errors.

However when studying some of the example systems that ship with RE, I'm troubled by the code in their NewBar methods. This
is from the BollingerPenetration system (I have removed some comments and irrelevant code for clarity);

BollingerBandLower BBL = new BollingerBandLower(14, 1.5);

public override void Startup()
{
BBL.SetInputs(Close);
}

public override void NewBar()
{
// Get the current calculated value.
double targetPrice = BBL.Current;

// Create a limit order based on the lower band calculation.
OpenPosition(PositionType.Long, OrderType.Limit, targetPrice);
}

To me this seems like a serious case of look ahead bias - the limit order is using a target price that is not known until
the bar has closed. Looking through other examples and the help files, I see this pattern repeating over and over.

My question is: Does the BBL.Current value reflect the latest available closing price in a correct way (that is from
the previous bar's close) or do we have a case of look ahead bias here?

Posted 2/12/2010 01:05:02 Post #10831
 

DeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloperDeveloper
The architecture of RightEdge is designed to prevent accidental lookahead. Conceptually, the NewBar method is called after each bar is closed. So the "Current" bar is in the past. When you call OpenPosition, an order is submitted, but it won't be processed until the following bar.

Hopefully that clears things up.

Thanks,
Daniel
Posted 2/12/2010 04:05:37 Post #10835
 

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie
I see, that's good news. Thanks for your reply.

On a related note then, how do I do if I want to incorporate the current bar's Open in my trading rules, if the order is only
created after the Close? Checking for overnight gaps is something I do quite a lot in my systems

Posted 2/12/2010 06:43:53 Post #10836
 

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being
I would think monitoring NewTick against current (previous) close would be the way to look for a gap. The first tick in regular trading hours would be the key indication.

-Pete
(See also rightedge-ats Yahoo group )

« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: billb, young, dplaisted

Permissions Expand / Collapse

All times are GMT -5:00, Time now is 7:14pm

2005-2007 © RightEdge Systems