Enter into trade over the next five days after a condition?
Author: chiswick451
Creation Date: 11/21/2013 4:39 PM
profile picture

chiswick451

#1
Hi

I am trying to back test a system that looks at a stock at its open on a particular day ---say " P- zero" and then enters into trades over the next five days based on how the stock has moved in relation to the stock at "P-zero". It then has a timed exit based on" P-zero1". Do i need to use a data series notation in order to do this or do i not have to be concerned about peeking when buying? Or am i altogether clueless!
profile picture

Eugene

#2
No. Here's a design pattern that you need to implement this sort of condition:

Tutorial: Setups, Triggers, Delays, and Timeouts

And below is an example of coding your strategy's rules based on that design pattern. Let's say your " P- zero" occurs when a stock is having a lowest open in 10 days. Then for 5 days you wait until the stock opens above the previous day's High. If that happens, you buy and install a 10-day timed exit; otherwise you don't enter and wait for next setup.

CODE:
Please log in to see this code.
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).