Click here to Login





                                                   Help with strategy

  0

0
Will
2015-02-25 17:15:39


Can someone please suggest a way that I can rank a group of ETF's and only purchase the top 4 ranking etf's so long as they are ranked lower than
the ETF SHY.

so I have a group of ETF which I rank using 12 month performance.

Rank12 = comp(perf(close,252),"rank");

buy = rank12 <5

This will buy the top 4 ranking etf's but I need a rule that says only buy if the rank is lower the SHY, so if SHY happens to be ranked 3 the buy would
only purchase the top 2 ranking etf's.

Any ideas? I'm new to programming in Quantshare and still trying to learn how these codes and functions work.

Thanks



QuantShare
2015-02-27 03:00:14

  0

The rank is lower than SHY means that the ETF perf must be higher than SHY perf.

For this you can use this formula:

p = perf(close,252);
Rank12 = comp(p,"rank");
shy = perf(getseries("shy", close), 252);
buy = rank12 <5 and p > shy;



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
Long strategy created with the money management tool
Reverse Collar Option Strategy
Global Market Rotation Strategy V1.4
Adaptive Strategy Indicator
Earnings Surprise Strategy

How-to Lessons
How to use QuantShare with Metastock data
How to associate an index with a list of stocks
How to create a chart with a black background
How to screen for stocks having a high correlation with the Dow J...
How to speed up watchlist and screener plug-ins when working with...

Related Forum Threads
Help With Daily Data Import Script
Problem with downloading a strategy
Need help with a MM Script
Help with Quantshare Language
Help with Survivorship Bias Free DB

Blog Posts
Money Management: Scale-in Trading Strategy
How to Backtest an Intraday Stock Trading System with EOD Ranking
How to Optimize a Trading System with Thousands of Billions of Co...
Backtesting a Strategy Based on Bond and Stock Index ETFs
How to deal with StockTwits data









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.