Click here to Login





                                                   Dynamic Watchlist Help

  0

0
Dave W.
2013-11-20 23:26:05


I'm trying to build an intraday trading system where, each day, the system chooses the top 10 stocks from a watchlist of the Nasdaq 100 constituents and only trades those 10 stocks. The following day, the system would re-rank / re-select the top 10 stocks and only trade those. The rank is based on stocks with the highest normalized intraday range (not ATR).

I thought the best way to do this would be to create a dynamic watchlist and assign that watchlist to my intraday trading system. I'm not sure if that's the best way to do it, though.

More immediately, though, I can't figure out how to get my dynamic watch list to rank the stocks. Here is my watchlist code. Based on removing the filter and examining the column values, the Comp functions both return NaN. I've read through a number of articles on the QuantShare site, and I think my Comp functions are properly formed. Are they correct? Any help would be appreciated.

// Choose the top X stocks from the Nasdaq 100 where the daily range
// is the highest over the last Y bars. The filter only considers
// stocks with 1M+ volume over last month, and a minimum price of Z.

TopRankLimit = 10;
SmaLookback = 10;
MinPrice = 10;

PriceVolumeFilter = close > MinPrice && sma(volume,22) > 1000000;
DailyRange = 100 * sma( (high - low) / close, SmaLookback );
AvgDailyRange = comp(DailyRange, "avg", 1, PriceVolumeFilter);
DailyRangeRank = comp(DailyRange, "rank", 1, PriceVolumeFilter);

filter = DailyRangeRank <= TopRankLimit;

AddColumn("DailyRange", DailyRange) ;
AddColumn("PriceVolumeFilter", PriceVolumeFilter ) ;
AddColumn("DailyRangeRank", DailyRangeRank ) ;
AddColumn("AvgDailyRange", AvgDailyRange ) ;



QuantShare
2013-11-21 12:10:04

  0

Best Answer
Using a watchlist will not work because symbols from a watchlist are retrieved only once (when the backtesting starts).

To implement your idea, here is what you should do:

- Calculate "DailyRange" in daily time frame

DailyRange = TimeframeApply(-1, 100 * sma( (high - low) / close, SmaLookback ));
DailyRange = TimeframeDecompress(DailyRange);

- Calculate ranking

DailyRangeRank = comp(DailyRange, "rank", 1, PriceVolumeFilter);


- Add ranking rule to your trading system:

If for example you trade stocks whose RSI > 70 then simply put:

buy = rsi(14) > 70;
buy = buy and DailyRangeRank



QuantShare
2013-11-21 15:55:02

  0


Dave W.
2013-11-21 16:39:01

  0

Excellent. Thanks for the quick response.


No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Dynamic Momentum Index
Dynamic Position Sizing
McGinley Dynamic Indicator
Traders Dynamic Index - TDI Indicator
VIDYA - Variable Index Dynamic Average

How-to Lessons
How to create a real-time watchlist
How to create a watchlist
Difference between the watchlist and the screener tools
How to create a volatility-based Stop - Dynamic stop based on the...
How to speed up watchlist and screener plug-ins when working with...

Related Forum Threads
Dynamic Watchlist update for each time step during a simulation?
Show Date Column when condition was true Dynamic Watchlist
Composites in a Dynamic Watchlist filter
Backtest against Dynamic WatchList
Composite with dynamic watchlist symbols

Blog Posts
Create Realtime Quote Sheets with the Watchlist Tool
Dynamic Position Sizing in your Trading System
How to Scan for Parallel Resistance and Support Lines
Troubleshooting a Trading System
Presentation of QuantShare's new Real Time Version









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.