Buy on any one of five days that follow a "trigger day"
Author: chiswick451
Creation Date: 11/19/2013 1:35 AM
profile picture

chiswick451

#1
hi

i am learning the code but i am having problems creating a back test which involves a loop within a loop.

i want to buy a stock on any or all of the following five days it drops below its price on the trigger day. So if my buy signal is triggered for a stock on 9/12 i want to buy it on 9/13, 9/14...9/18 if it is below a limit price.

any suggestions

thanks
profile picture

Eugene

#2
Check out Strategy Window > Strategy Builder > MC, Multi-Condition Group in the WealthScript Programming Guide. By setting the "Lookback Period" to 5 in your Rule-based Strategy, your chosen buy condition can now last for 5 bars. After having finished building your Strategy, click "Open Code in new Strategy Window" to review the code behind it.
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).