What am I doing wrong with Priority Cutoff?
Author: swuzy
Creation Date: 7/18/2010 9:41 PM
profile picture

swuzy

#1
Sometimes a strategy generates too many alerts. This results in a randomness factor on subsequent reruns.

"Priority" allows for ranking Alerts by various methods of logic, but can still result in too many alerts for a visual review and manual analysis selection. The following priority sort using one method of ranking was created with a Priority Cutoff level to help reduce the number of alerts that is listed and presented for viewing.

However I notice that on some backtests, Trades were taken on symbols with blank priority, resulting in a randomness on re-runs that made it more difficult to evaluate whether the change in results were due to code tweaks that were made, or to randomness of the program's selecting trades on symbols with blank priority.

Can the code be adjusted so that symbols that are below the cutoff priority will not be listed in Alerts and not be picked up as a Trade?

Thanks for your help.

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

Eugene

#2
What's a blank priority? How are you determining that it's blank -- using the Trades+ visualizer?
profile picture

swuzy

#3
After a strategy run, the display shows a tab for "Trades", listing each trade (buy, sell, profit, etc), and there is a listing for Entry Name generated which notes the Priority assigned to each trade. While most have priority numbers some do not. When I reduce the size of the priority cutoff number, there are fewer trades with blank priority numbers.
profile picture

Eugene

#4
"Trades" don't display priority, while "Trades+" does. In any case, we need more details and screenshots.
profile picture

swuzy

#5
Correction, "Trades" displays a listing for "Entry Name", and under that heading are listed the priority numbers.

What is confusing to me, is that when I increase the priority cutoff number, not only does the number of blank priority trades increase, but the number of overall trades reduce as well.

So maybe it is due to some other errata in my code. I know my code has incorrections, because when I look at the charts, when it should be avoiding purchases according to the planned logic, it is still purchasing.

So I should try inserting the cutoff code into some simpler canned strategy for some more testing of my cutoff question.

I have not been able to insert copies of screen shots into "IMG" in these posting notes. How is that done?
profile picture

swuzy

#6
So below is a canned strategy "Moving Average Crossover" in the Trend Following folder. It has been modified with the Priority Cutoff code and a Cutoff Number of 34. When I run it on the DOW 30, using 2 years, 20% equity, say $50,000 start capital, there are many trades with blanks in the Entry Name, resulting in randomness on re runs.

I now understand that this is simply because the "Buy" routine is not using something like

CODE:
Please log in to see this code.


Can you please help provide the proper code wording for such a qualifying line?

Thank you.


CODE:
Please log in to see this code.


profile picture

Cone

#7
There are two BuyAtMarket signals in the strategy, priority is not assigned to the Position created by the first one and a signalName is not provided for it (blank).

It looks to me like the first BuyAtMarket statement isn't even supposed to be part of the strategy and that the CrossOver statement should control the big priority block.... but it's not my Strategy, so I have no idea really.
profile picture

swuzy

#8
I am not sure how the details work, or how signalName works or the syntax of how to use it, but it appears to work after a very simple fix, with very simple coding words.

I simply added a PriorityCutoff variable and added to the first BuyAtMarket statement

CODE:
Please log in to see this code.


So,

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

Cone

#9
QUOTE:
how signalName works or the syntax of how to use it
Place cursor over a WealthScript keyword, like BuyAtMarket, and strike F1. The will open the QuickRef to the BuyAtMarket entry (it also opens the User Guide) complete with syntax showing signalName, which is the second string parameter.

It seems you're slapping code together without actually knowing what the strategy is or should be. My point was to remove that BuyAtMarket signal because it will trigger whenever a CrossOver occurs - without any conditional priority. If you remove it, then the CrossOver condition will control the entire "priority block" that leads to the BuyAtMarket and assignment of Position.Priority.
profile picture

swuzy

#10
Thanks for the guidance and comments.

Actually, I know what I want the strategy to do, but yes, I am slapping together code, without fully understanding their syntax and usage, and getting frustrating results.

I removed the first BuyAtMarket signal, it compiled, but generated no trades.

Including the first BuyAtMarket signal, compiles and runs, but on analysis of the charts, it is clearly not the intended result, as there were a few purchases and no sales at all.

Moving the first BuyAtMarket signal, to below the priority block, results and both buys and sales and hopefully is the correct syntax for what I was hoping for (but I have not validated that everything is working as it should).

So,

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

swuzy

#11
No, the results are still wrong, because now Trades tab shows no priority ranking numbers under the Entry Name field.



profile picture

swuzy

#12
Re-ran the original "full" code posted above on Dow 30, changed period from 2 years to 5 years. Yes, now there are closed trades showing and priority numbers are showing up in the Trade tab's Entry Name heading.
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).