Strategy Monitor not giving Alerts
Author: rmcginniss
Creation Date: 6/11/2009 8:15 AM
profile picture

rmcginniss

#1
Having an issue where my strategies within the strategy monitor are not giving alerts. Settings like, data, range and scale are all correct. I can "see" the trigger on the charts, but the monitor is not picking it up and therfore no alerts. Customer support has been no help. Ant thoughts out there? Thanks.
profile picture

swuzy

#2
You probably have to share your script, at least a "cleaned up" version of it, perhaps, including the actual script framework, and substituting some generics for key buy sell logics (although the buy-sell logic or how they interact with the rest of the script is probably where the actual problem lies), to get a top view sanity check.

profile picture

rmcginniss

#3
The triggers work in back-test mode. They just do not give an alert within the strategy monitor. Script is below.

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

Eugene

#4
Please find a detailed explanation of what's going on behind not getting the alerts in Robert's article HERE.
profile picture

Cone

#5
In addition to that, see the WealthScript Programming Guide: Programming Trading Strategies > Alerts > How to: Alert for AtClose Signals.
profile picture

swuzy

#6
I do not know much at all about coding. I did add a few end curly brackets to your posted scripts before running a few back tests on them. (You should have clicked on the "CODE" button above the Post window, and inserted your script into it so that it shows up correctly formatted.)

The script does not appear to generate the normal symptom of peeking, as I do not see high profit results from backtests.

Assuming for the moment that there is nothing wrong with the script, please double check your back tests' "Trades" column and scroll down to see when are the last dates that alerts were triggered by them.

My backtests ... daily bars on Dow, Nasdq, S&P, IBD, Russell 3000, suggests that this script has a relatively low number of trades and the last trade alerts might have been up to several weeks ago.

So even if the script is all correct, maybe you should not expect daily alerts out of it.
profile picture

Cone

#7
The script won't create Alerts because it's not programmed properly to create them.
profile picture

swuzy

#8
So, ... you generally need to use "bar+1" if you want to generate an alert. If you buy or sell at the (current) bar (...AtClose), it has already happened, so there is no point or need or ability to alert you to take any buy/sell action prior to and for the next bar.

I suppose if you want the script to generate a post execution alert of AtClose orders (although in actual trading your brokerage will give you more than sufficient post execution alert), you can try a workaround by doubling up the BuyAtClose and SellAtClose (bar, ...) lines with a second order of the same using (bar+1, ...), assuming you have padded sufficient equity/margin/short capability to generate a double transaction. That however, would surely mess up your performance benchmarking. On the other hand I probably have no real idea of what I am talking about.

The material Cone references says:

QUOTE:
How to: Alert for AtClose Signals

Strategies that use AtClose orders generally intend to open or close a Position on the close of the current bar, i.e., the one just processed. Consequently, you'll generally pass bar instead of bar + 1 to an AtClose signal, and therefore it's not possible for Wealth-Lab to Alert you for a trade. Theoretically, Wealth-Lab has no trouble executing such a trade, however, in practice it's actually quite impossible to process data from a bar that has just completed and then execute a trade on the close of that same bar.



However, if you were able to access partial bar data (Wealth-Lab User Guide: Yahoo! Data Provider), it would be possible to update a Daily bar just prior to the market close to get an estimate of the final closing price with which to execute a trade. The trick, however, is to use an AtMarket order in place of the AtClose order when processing the last bar as demonstrated below.

Example (How to run Example code?)

C#

CODE:
Please log in to see this code.


On intraday scales, the only difference between AtClose and AtMarket orders is 1 trade. Since intraday AtClose signals cannot be realized by any practical means, they should rarely - if ever - be used in intraday Strategies; AtMarket signals are preferred. An exception would be to close intraday Positions at the end of the trading day in the same manner as described above.


profile picture

zanek

#9
I ran into this problem as well. Thankfully I saw this post a little while afterwards and saw what was going on.

Anyone can correct me if I'm wrong, but isnt the way it works is that the current bar has already occurred when you are using it within the OnExecute() function for loop, so trying to use it within BuyAtMarket() wouldnt really work in live trading because you'd be buying after already looking at what just occurred. So 'bar' is the last interval that just occurred and bar +1 is the next interval if I am correct

I could be wrong of course, but that was my understanding of it after reading the wiki link. Thanks
profile picture

Cone

#10
That's precisely correct. The data that you see in the chart are completed bars - how could they be anything else? After loading the data, the script processes it to generate an action on the next bar.
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).