I have set up several tradable trendlines for stocks in a single watchlist. When I try to run a backtest on the symbols in my watchlist, I do not get any alerts. When I go thru the stocks one by one, several of the stocks have an alert.
Is this a bug or am I doing something wrong?
Size:
Color:
See if the passage about SetContext in the Remarks section for TrendlineValue in the QuickRef applies to your case.
If it's not the case, then this might be a bug or you're doing something wrong. But if you show us an example of what the backtest is doing and it performs not as expected, we might be able to tell more precisely. ;)
Size:
Color:
Eugene,
Here is how I am trying to use tradeable trendlines.
1. I scan my charts and draw tradeable trendlines at prices where I want to review the chart again.
2. I start a new script using "New Strategy From Code".
3. When I click on a symbol using this new script, I get an alert if my tradeable trendline is crossed. This alerts me to review the chart.
4. When I highlight the dataset name and run backtest of all symbols in the dataset, I do not get any of the alerts I get when I look at the charts one at a time.
Size:
Color:
Between #2 and #3, anything can happen. It's your code, and we have no idea what you're doing there. ;)
Size:
Color:
The script is the default script you get when you get "New Strategy from Code". There is no logic in the script. WLP is kicking the alert out on its own when you run the default script on a single symbol.
Size:
Color:
Thanks for the clarification.
Same QuickRef remark fully applies here. It's not possible to access a Trendline value because in a multi-symbol backtest, there is no Chart for the TrendLine to exist.
Size:
Color:
So the ONLY way to use trendlines is when you access a single chart.
Size:
Color:
Right, in a single chart.
Let's clarify something though. First you said "Tradable Trendlines". A TT is a specific drawing tool. TTs "inherit" from Trendlines (they have all the same properties of a Trendline), but you don't have to access a TT name in your code to get alerts. Even so, they only work in a chart window.
Finally, it's not necessary to have a chart if your code actually "draws" the TT. I say "draw" because it doesn't really have to DrawLine(), it needs only to "know" where the line is, i.e., calculate it.
Size:
Color:
Cone and Eugene,
Thanks for the education. I now understand the difficulty.
I love the concept of being able to draw tradable trendlines and then being able to scan for them each day. When one of the trendlines is broken, I know I want to review that chart. The concept works great on a single chart. Now my problem is the lack of scanning. I could view each chart seperately but that is a pain.
Now let's talk about a workaround. One concept is to have a script that I use when I draw the tradeable trendline determine and save two points on each line. The only trendline data that I am aware of that you can access is the trendline value at a particular bar so that is what I have to work with.
My second script, a scan script, would then retrieve the two points per tradable trendline for any chart that has tradable trendlines, and calculate the trendline. I could then determine if the trendline is broken on the day of interest and give an alert.
This is a long way around but I believe it should work. Do you see any problems with what I have described? Do you have any suggests to improve it or suggestions for a better workaround?
Size:
Color:
Until someone comes up with a better plan, it sounds like it will work. If you create a class to store and retrieve the line(s) for given symbol, the solution oculd work practically seamlessly, and you don't even have to be confined to a single time frame as manually-drawn TLs require.
Size:
Color:
Size:
Color:
Size:
Color:
I know, that's where I got it! ;)
Size:
Color: