Backtest using hourly indicators AND daily indicators simultaneously
Author: tempt187
Creation Date: 12/26/2013 2:42 AM
profile picture

tempt187

#1
It seems you can only pick indicators for backtesting based on ONE time frame, say hourly for example, but what if I want to trigger trades based on the hourly indicators AND when the daily indicators are also in alignment?

How do I do this?
profile picture

Eugene

#2
Rule-based strategies are limited to one time frame -- the one currently applied to the chart. Code-based strategies are much more flexible. See the WealthScript Programming Guide > Multi-Time Frame Analysis > Intraday/Daily etc.

Plus many examples available by searching the forum for the keywords like multiple time frame, SetScaleDaily/SetScaleWeekly etc., in the Wealth-Lab Wiki (Knowledge Base section).

Wiki:
Intraday / Multi-Time Frame | Mixing intraday and daily data

Forum:
How to plot bigger timeframe bars but keep strategy working on shorter timeframe?
Combining daily and intraday scales in a single strategy

profile picture

RoseyF

#3
How do you change a rule-based strategy that buys after a percent drop from the previous day's close on a one-minute scale? What is happening for us is that the rule-based strategy is buying after a percent drop not based on yesterday's close, but based on the one-minute time scale during the day.
thank you!
profile picture

Cone

#4
The appropriate condition for that does not exist for an intraday Strategy. When you need to do something a little more complex like that, you can use the Rules to generate the framework of the Strategy and then you need to unlock the code for manual editing. In general, intraday strategies require special attention.

Here's an easy way to find the percent change from yesterday's close at the current [intraday] bar.

CODE:
Please log in to see this code.

Notice that the loops starts at "this.FirstBarofDay(2)", i.e., the first bar of the second day. You must install the Community.Components extension for that to work.
profile picture

RoseyF

#5
The code below is from the rules based drop down menu. What I am trying to do is buy during the day when the stock is below yesterdays closing price by a certain percent. In this case 5%, I would like to use a 1 minute time frame. But what the code is doing is buying, not based on yesterdays closing price, but when the stock drops 5% from the days 1 minute trading.
Thanks again for your help.

CODE:
Please log in to see this code.
profile picture

Eugene

#6
Here's your tweaked strategy with Cone's code integrated. You have to install the Community Components library for that to work. Before it's possible we need to verify your WLP entitlement (please create a support ticket).

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).