Click here to Login





                                                   Only Specific Instrument in Simulator

  0

0
ymlee
2017-11-04 08:59:50


How could I short only a few specific instrument for hedging purposes?

Example:

Idx = GetSeries(".HSI", close) ;

Buy = cross(close,sma(100)) and idx > sma(idx,200) ;
Sell = cross(sma(100),close) ;

Short = idx < sma(idx, 200) and symbol = "1234.HK | 5678.HK | 7100.HK" ;
Cover = idx > sma(idx, 200) ;



QuantShare
2017-11-06 02:48:41

  0

Best Answer
Instead of
Short = idx < sma(idx, 200) and symbol = "1234.HK | 5678.HK | 7100.HK" ;

You need to put something like
Short = idx < sma(idx, 200) and (stringequal(name(), "1234.HK") or stringequal(name(), "5678.HK") or stringequal(name(), "7100.HK"));

However, proper hedging should be done using a money management script.
Example:
Hedge a portfolio strategy





Hedge a portfolio strategy (by QuantShare, uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

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
Indicator/Price Value on a Specific Trading Date
Number of Days to a Specific Date
Price at a specific Intraday Time
Stop Loss for the N-first Trading Bars only
Return Since a Specific Condition Occurred

How-to Lessons
How to download EOD quotes for active and valid stocks only
Difference between the watchlist and the screener tools
How to copy a trading item
How to plot a time-series that do not update the chart scale
How to quickly select stocks based on the last value of a databas...

Related Forum Threads
Buy a specific instrument via QS vector language
Simulator - Activate stop immediately
Simulator Trading System Report
Simulator Question
Logarithmic Scale for Price-Data-Chart only

Blog Posts
How to Download Trading Data for Certain Securities Only
3 ways to rank stocks in a trading system - Simulator and Potfoli...
Limit and Market orders
QuantShare Trading Software: New Features in the 3.1.2 Version
How to Backtest Each Stock or Asset Individually









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.