WolfMan 7 posts msg #117697 - Ignore WolfMan |
1/11/2014 8:04:08 AM
The below works when I filter - but when I try to backtest and select by column 5 decending - all I get are the highest priced stocks. Any ideas on the phrase I need to use in "select by" for it to work
/* 1 month weighted at 80%*/
set{1m, roc(21,1) * .80}
/* 2 months weighted at 20%*/
set{2m, roc(42,1) * .20}
/* add them together */
set{z, 1m + 2m}
/* present column value of z */
add column z
/* present line chart of z */
draw z
sort column 5 descending
|
mahkoh 1,065 posts msg #117705 - Ignore mahkoh |
1/11/2014 7:50:42 PM
Did you by any chance just put in "sort column 5"? Try putting in the whole filter.
|
WolfMan 7 posts msg #117711 - Ignore WolfMan |
1/12/2014 8:35:30 AM
I just tried both - did not work. I'm not sure what I need to do when backtesting to sort the securities as it works when filtering. The output is always the top trading stocks based on price when backtesting.
|
mahkoh 1,065 posts msg #117712 - Ignore mahkoh |
1/12/2014 9:33:35 AM
Maybe specify the column by its name? 'Sort column z descending'
|
Kevin_in_GA 4,599 posts msg #117714 - Ignore Kevin_in_GA |
1/12/2014 10:19:44 AM
Put in the whole filter - really just the lines that build the variable you are sorting on, then add "sort by z descending". SF backtesting doesn't care about anything you put in a column, draw on a graph, or that is not needed to do the sort.
|
WolfMan 7 posts msg #117723 - Ignore WolfMan |
1/13/2014 8:34:55 AM
Thanks Kevin. I put the above in the filter and the below in the select by box
set{1m, roc(21,1) * .80}
set{2m, roc(42,1) * .20}
set{z, 1m + 2m}
Sort by z descending
I am still getting results based on the top priced stocks. I am trying to select the top 4 and set the parameters to only have 4 open trades. But I'm still getting the to prices stocks not sorted by "z".
|
WolfMan 7 posts msg #117724 - Ignore WolfMan |
1/13/2014 8:50:33 AM
Got it!! Thanks. I just changed "sort" to "select"and it worked.
|
Kevin_in_GA 4,599 posts msg #117726 - Ignore Kevin_in_GA |
1/13/2014 2:12:26 PM
That is right - select, not sort. Glad it is working for you.
|