trades are set to occur 3 bars after
Author: Dan Lutkenhouse
Creation Date: 3/17/2009 1:33 PM
profile picture

Dan Lutkenhouse

#1
Hi, I am new to WLP and am trying to come up to speed by doing some simple trades. I have noticed that it appears when using the rules engine all trades are set to occur 3 bars after the actual formula should have triggered the trade (int bar = 1; bar < Bars.Count; bar+).

It appears that you can move that up a few bars by editing the code “bar + 1” to “bar + 0” but it still lags a bar when it triggers which in today’s market can make the difference in the strategy.

I called Fidelity WLP help and they said they had heard about this but had no idea and never got back to me.

Questions:
a) is there a reason behind this?
b) Is there a way to get the transaction to occur when the mathematical event actually happens on that bar?
c) Am I missing something here?

Thanks
profile picture

Eugene

#2
Trades do not occur 3 bars after, rather on the following bar. Editing the code to "bar+0" should only be made when you really understand what you're doing, otherwise it will create a peeking effect. See Knowledge Base -> Peeking for more details.

QUOTE:
b) Is there a way to get the transaction to occur when the mathematical event actually happens on that bar?

Probably there is misunderstanding here. A mathematical event that utilizes this bar's prices, such as the EMA turning up or down, isn't happened until after the bar is closed.

For some indicators it's possible to reverse engineer the target price:
RevEngRSI
RevEngSMA_TC (Tomorrow's Close)
profile picture

Cone

#3
Also see Bars, Loops, and Bar + 1. This was written pre-Version 5, but all the same ideas still apply.
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).