Click here to Login





                                                   Question on going all cash or buying short term treasury etf

  0

0
Amritendu Maji
2017-06-20 23:41:23


Thank you for all your help. It is very much appreciated.

I am looking at a system where if the Momentum conditions are met but the stock price is below its 200 day moving average, I want to buy the short term treasury ETF SHY.

Next month, if all the conditions including the moving average, then SHY is sold and the selected stock is purchased.

Is there any way to code it without going into money management add on?

Thank you,
Maji



QuantShare
2017-06-21 19:41:05

  0

Are you referring to the "stock price" of "SHY" (below its 200 day...) ?
Regarding the "Next month" part, you would need to use the money management script as the strategy formula is used to generate signals only and thus doesn't know which stocks/ETFs where bought or not.



Amritendu Maji
2017-06-21 19:51:16

  0

Say I am looking at SPY, QQQ, DIA and MDY. Supposed MDY and QQQ have the highest momentums. However, MDY is below its own 200 day MA and QQQ is above its own 200 day SMA. Then, I want to purchase QQQ and SHY.

I hope this explains the strategy.

Thank you,
Maji



QuantShare
2017-06-23 18:47:20

  0

Best Answer
You will need to rank all the securities (including SHY). In the ranking formula, you add a condition so that if an ETF is below its 200 bar MA it gets a value of 0.

Example:
f = perf(close, 25);
f = iff(close > sma(200), f, iff(stringequal(name(), "SHY"), f, 0));
a = comp(f, "rank") <= 2;



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
Short Term Trading System with RSI Ratios
Long Term Up Trend with Short term re-entery Signals
ETF Number of securities, percent stock and cash - Historical Dat...
Short Term Bullish signal for NSE Stocks
Short Term Volume and Price Oscillator

How-to Lessons
How to detect stocks trading near all time highs
How to generate buy/sell signals from a trading system
How to create a volatility-based Stop - Dynamic stop based on the...
How to remove non-active securities
How to get fundamental data for U.S. Stocks

Related Forum Threads
Money management script question
How to import the list of of all mutual funds tickers?
My trading algorithm won't stop buying shares
PORTFOLIO-CODE FOR BUYING PRICE
Simulator Question

Blog Posts
Short Selling Stocks
Long Term Trading with Technical Analysis
Backtesting All Candlestick Patterns in 10 Minutes
Creating Stock & Market Short Interest Ratios using Historical Sh...
How to combine long, short and custom portfolio strategies within...









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.