Is it possible to get alerts for Sell Stop Orders on a daily basis for the next day?
For instance, with an up trendline, I would like to sell if the price goes below the trendline. It would be more beneficial to place an actual order as a sell stop order in the morning based on the value of the trendline the previous day.
Is it possible to get an alert each day to place a sell stop order (with the new value) for the next day (bar +1), based on the value of the trendline value today?
Each day then, a newly revised sell stop order could be placed.
Size:
Color:
Obviously, it's possible to get alerts for Sell (Cover, Buy...) Stop (Market...) orders for the next bar (bar+1).
As to getting alerts when the price crosses a manually drawn trendline, you use
TrendlineValue for that. It works only if the symbol has a trendline in an open Chart window - not in the Strategy Monitor or Rankings tools. For a code sample, please refer to the QuickRef for
TrendlineValue. Be sure to read the remarks and/or this FAQ:
TrendlineValue can't be accessed.
Size:
Color:
Here's a script example that:
1. Finds a trendline based on the two most recent troughs using the Close series
2. Draws and extends the line from Lows of those trough bars
3. Creates an Alert to SellAtStop tomorrow at 2% below tomorrow's value of the trendline if today's close is above the line.
Note that extending a line is dependent on the chart's linear/log scale. The extension of the line in a linear chart wouldn't look straight if you extended the line using a log calculation, and vice versa. You can see this if you run the script
and then change the chart scale between linear and log.
I mention this for 3 reasons.
1. The value of the stop will change depending on the chart scale.
2. If you run the script in a MSB, the trendline value will be based on the scaling used for the last chart displayed.
3. If you run the script in the S. Monitor, the linear calculation will always be chosen since "if (cp.LogScale)" will probably evaluate to false, always.
CODE:
Please log in to see this code.
Size:
Color:
It works! You certainly gave me more than I asked for. Thanks.
Not familiar with some of the lingo. What is MSB and S. Monitor?
Size:
Color:
Multi-Symbol Backtest and Strategy Monitor.
Size:
Color:
In the program from Cone, public class is used:
CODE:
Please log in to see this code.
I am trying to find out how to access the public classes in Wealth Lab Rules. From Wealth Script Programming Guide:
QUOTE:
A number of classes found in the WealthLab.Rules{} and WealthLab.Rules.CandleSticks{} namespaces support the implementation of fundamental-based and other rules. The classes are not actually necessary to create the rules, but their use provides indirection, which hides the implementation details helping to keep your strategy code saner. Of course, programmers can access any of the public methods without resorting to the Strategy Builder.
How exactly does one find out what public methods are available and access them?
Size:
Color:
Here's the list of all public methods in the library:
Size:
Color:
When you see "public" "private", "internal", and the like, these are declarations of classes and methods right in front of you. They're not referring to anything else.
Eugene showed you where documentation of the public methods in WealthLab.Rules is. But, unrelated to WealthLab.Rules, each Strategy is a class and you can name it anything you want. I named the class TrendlineStopAlert arbitrarily, because that's what it does. public TrendlineStopAlert() is the contructor of the TrendlineStopAlert class that derives from WealthScript. Constructors for WealthScript classes are mostly used to initialize strategy parameters, as it does here.
Size:
Color:
That answers my question. Thanks.
I have been spending a lot of time getting familiar with the programming aspect. It is all pretty straight forward, but the biggest problem is working with the brackets. Do you experts have software that automatically puts the brackets where they are supposed to, or do you just do it manually? If there is software that does this, what is it?
Size:
Color:
Software can't read minds (yet). You have to place brackets around the code that a statement should modify.
Google "curly braces" and you'll find plenty of information.
Size:
Color:
Just wanted to know to head in the right direction. I googled "curly braces" and did find information.
Thanks
Size:
Color: