Combining Daily and Weekly Trading Modes
Author: pestocat2
Creation Date: 12/18/2019 6:53 PM
profile picture

pestocat2

#1
Is it possible to use Daily mode for a buy and then use the Weekly mode for a sale.
Thank you
profile picture

Eugene

#2
If you mean "to use SetScale.../RestoreScale inside a trading loop", then this is not supported in WealthScript.

For anything else like "use an indicator on Daily scale for a buy and then its (or another indicator's) value on Weekly scale for a sale", it's certainly possible. Check out the WealthScript Programming Guide > Multi-Time Frame Analysis and the QuickRef > Time Frames for code samples. And since it's been a popular question, I'm sure that a forum search will add a hundred or two examples more.
profile picture

pestocat2

#3
Yes, that is what I was looking for.
Thank you
profile picture

Eugene

#4
You're welcome.
profile picture

pestocat2

#5
I used the example on page 91 of the Programming Guide in order to code for my needs. I used the 2/5 EMA crossover to make a new buy. I then test to see if the 3/8 Stochastics had a crossover for both the Daily bars and Weekly bars. I sell when both Daily and Weekly K is below D at the same time. I plotted the 2 3/8 Stochastics data streams to confirm the Sell is done correctly. One issue is the weekly data range should go back further in time compared to the daily data. Using weekly bars is important because it smooths out some of the daily ups and downs without getting stopped out. I use this program to back-test 3X ETFs, e.g., SOXL, TECL, TQQQ, and UPRO. Results for 2019 are excellent.
profile picture

Eugene

#6
QUOTE:
One issue is the weekly data range should go back further in time compared to the daily data.

Is this what you're looking for?

Wealth-Lab User Guide > Strategy Window > Backtesting Strategies > Inside a Portfolio Simulation > A Lead Bars Solution

Just FYI, the online guides in the WLP Help menu may contain content not available in the PDF versions. The electronic versions receive content additions/updates in the first place. So when I refer to a Guide I always do so with the built-in version in mind.
profile picture

pestocat2

#7
Eugene,
Thank you for the suggestion. What I did was to define the date when to start trading. Then with each bar I check to see if the day, month, and year match my desired trade start and then I set a Boolean to true. No trades can occur unless that Boolean has been set to true. Now I set the Data Range such that all my data series are complete when the trading starts.
Thank you
profile picture

Eugene

#8
Glad you've found a solution on your own. Merry Christmas!
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).