This is a trading item or a component that was created using QuantShare by one of our members.
This item can be downloaded and used by QuantShare Trading Software.
Trading items are of different types. There are data downloaders, trading indicators, trading systems, watchlists, composites/indices...
You can use this item and hundreds of others for free by downloading QuantShare.
Top Reasons Why You Should Use QuantShare:
Works with US and international markets (stock, forex, options, futures, ETF...)
Offers you the tools that will help you become a profitable trader
Allows you to implement any trading ideas
Exchange items and ideas with other QuantShare users
Our support team is very responsive and will answer any of your questions
We will implement any features you suggest
Very low price and much more features than the majority of other trading software
For Free - No Credit Card Required
Trading System based on the Previous Week SPY Return
This strategy enters a position in the S&P 500 Index (SPY or ^GSPC) when previous week return is negative (Return is calculated based on Monday open price and Friday close price), the trade is closed at the end of the week on Friday. No stop rules are defined.
The trading system formula calculates the previous week time-series using the "TimeframeApply" and "TimeframeDecompress" functions.
The sell rule consists of comparing the day of the week (dayofweek() function) to 5 (Friday).
The order types were modified using the "SetSimTiming" function.
Buy Order: Buy at tomorrow open price
Sell Order: Sell at today close price
You can reference return two weeks ago by using the "ref" function and calling it just before decompressing the data. Decompressing a time-series calculated in a different time frame aligns or synchronizes this time-series with the current time frame.
pweek = ref(pweek, 1);