Quarterly Time Periods

Posted by Profitspi Admin at 7/7/2017 12:00 AM

In addition to Daily, Weekly, Monthly and Yearly you can now create screen and backtest criteria using Quarterly time periods:

You can also choose to view charts using Quarterly bars.


Tips series: Screening for reversals

Posted by Profitspi Admin at 3/27/2017 12:00 AM

A common request is to screen or test for some kind of reversal in direction for an indicator.

This MACD Reversal screen from the screen library includes some sample criteria which you can change and extend as needed:

The relevant reversal criteria is shown below:

MACD Line (12 26 9) increasing for 2 bars

and MACD (12 26 9) [-2] decreasing for 20 bars

In this screen we are looking for stocks where the MACD had been decreasing for 20 bars but then increased for 2 bars.

The [-2] Offset setting is what allows us to backdate the first criteria to 2 bars prior to the current bar.

 

Variations

The 'MACD (12 26 9) [-2] decreasing for 20 bars' criteria requires downward movement on all 20 bars. If a stock has one flat bar or even a small upward movement it will fail the criteria.

To be less stringent you could apply a moving average to the MACD line:

SMA(MACD (12 26 9) 3) [-2] decreasing for 20 bars

Or you could break the criteria into chunks:

MACD (12 26 9) [-2] less than MACD (12 26 9) [-7] and MACD (12 26 9) [-7] less than MACD (12 26 9) [-12] and MACD (12 26 9) [-12] less than MACD (12 26 9) [-17]

Please get in touch if you need any assistance.


Tips series: Screening by Fundamentals

Posted by Profitspi Admin at 1/17/2017 12:00 AM

Our fundamentals coverage for US stocks now includes up to 40 data items such as EBITDA Margin, Free Cash Flow, EPS, and many more with history going back as far as 2001. The data is collated from company filings.

This Fundamentals Screen from the Screen Library includes some sample criteria which you can extend and activate as needed:

Items from the criteria will be auto-included on the grid but you can add additional items to the grid, even though they are not in the criteria, by using 'Customize Grid Columns'.

The full list of available fundamental items is shown below:


Trailing loss minimum gain

Posted by Profitspi Admin at 11/29/2016 12:00 AM

You can now specify an optional minimum gain for trailing loss stops.

In the example below the trailing loss is 15% but it will not be active until the position has gained at least 5%.


Technical analysis API to Excel

Posted by Profitspi Admin at 10/13/2016 12:00 AM

Our API now allows you to retrieve historical instrument data in CSV format which is ideal for use in Excel.

Retrieve your API key

First you need to get an API key. For that you will need to be a subscriber.

Navigate to the API page using the link at the top right of any page:

Click the 'Generate API Key' button to retrieve your key:

Get the list of indicator aliases

The API documentation page at https://www.profitspi.com/api/v1/swagger/ui/index has plenty of info on all the API functions but for the purposes of this post we are only looking at the ReferenceData indicatoraliases API function and the Instruments instrumenthistory API function.

You will need to know the indicator alias codes in order to retrieve the data you need from the instrumenthistory API function.

Format the following address, replacing apikey and userid with your own, and enter the address into a browser address bar:

https://www.profitspi.com/api/v1/indicatoraliases?api_key=apikey&user_id=userid&format=csv

You should receive a file of alias codes as follows:

Retrieve instrument history data

Using the list of alias codes and the instrumenthistory API function you can specify what types of historical data you would like to retrieve.

Format the following address, replacing apikey and userid with your own, and enter the address into a browser address bar:

https://www.profitspi.com/api/v1/instrumenthistory/ibm?api_key=apikey&user_id=userid&format=csv

You should receive a file of basic historical information as follows:

But by adding one or more 'additional value' parameters we can retrieve any additional data we need. Up to 10 additional value parameters can be specified as av_0 thru av_9.

So if you extend the API address as follows:

https://www.profitspi.com/api/v1/instrumenthistory/ibm?api_key=apikey&user_id=userid&av_0=CLOSE&av_1=VOLUME&format=csv

You should now receive a file of historical information as follows:

A more complex example could include indicators with parameters, custom inputs, offsets, and different periods:

https://www.profitspi.com/api/v1/instrumenthistory/ibm?api_key=apikey&user_id=userid&av_0=SMA(50)&av_1=MACDHIST(12 26 9)&av_2=SMA(VOLUME 50)&av_3=SMA(10)[-1]&av_4=WEEKLY BBUPPER(SMA(50) CLOSE 30 2)&format=csv

You should now receive a file of historical information as follows:

Other parameters

  • per_page and page allow you to page thru the result set. The defaults are 100 for per_page and 0 for page
  • period_type can be specified as "W" for Weekly, "M" for Monthly, "Y" for Yearly. Default is "D" for Daily
  • begin_date and end_date can be specified to restrict the retrieval. Format is yyyy-mm-dd

Excel data functionality

Experienced Excel users can take advantage of the Excel data retrieval function at Data > New Query > From File > From CSV. This will allow you to easily refresh the sheet with the latest data without having to do a file download each time.


Heikin-Ashi screening and charts

Posted by Profitspi Admin at 8/5/2016 12:00 AM

We now provide screening and charting of Heikin-Ashi candlesticks. Heikin-Ashi charts are an adaptation of candlesticks which use averaging to filter out noise and better highlight trends.

The two charts below show standard candlesticks followed by Heikin-Ashi candlesticks. You can show indicators on the chart such as SMA, MACD, etc with the standard inputs but you can also use 'Custom Inputs' to show SMA, MACD, etc based on Heikin-Ashi values.

Heikin-Ashi Chart

Heikin-Ashi Uptrend Screen

Heikin-Ashi Downtrend Screen


Fixed amount backtesting costs

Posted by Profitspi Admin at 7/30/2016 12:00 AM

As well as percentage-based Entry and Exit costs, you now have the option for fixed amount costs. Useful if your broker charges fixed commissions per trade.

Just choose '$' for fixed amount or '%' for percentage as shown below.


API now available

Posted by Profitspi Admin at 5/27/2016 12:00 AM

Our API is now available for personal and commercial use. The API provides functions for Backtesting, Screening and calculating Instrument technical values. Find out more at our API page.

Sharpe Ratio now available

Posted by Profitspi Admin at 5/26/2016 12:00 AM

We have added a Sharpe Ratio calculation. You can specify your own time period and type of bars, Eg Monthly, etc.

As shown below, the default setting is 252 daily bars.

More info on the calculation is shown here.

The Sharpe Ratio is also calculated for strategy tests and is included in the summary results.


Canadian Exchanges

Posted by Profitspi Admin at 4/19/2016 12:00 AM

We have expanded our data coverage to include the Toronto Stock Exchange and the TSX Venture Exchange. Check out our full list of Exchanges.

London, Hong Kong and Singapore Exchanges

Posted by Profitspi Admin at 2/25/2016 12:00 AM

We have expanded our data coverage to include London, Hong Kong and Singapore. Check out our full list of Exchanges.

AAII Editors' Choice again for 2015

Posted by Profitspi Admin at 2/14/2016 12:00 AM

For the second year running Profitspi.com has been awarded American Association of Individual Investors Editors' Choice for Technical-based Stock Screening. Read the review...

Dynamic Beta Calculation

Posted by Profitspi Admin at 12/25/2015 12:00 AM

We have enhanced our Beta calculation. Previously we calculated a 36 month Beta on a periodic basis but now you can specify your own time period and type of bars, Eg Monthly, etc.

As shown below, the default setting is 200 daily bars.


Additional Fundamentals and more History

Posted by Profitspi Admin at 12/25/2015 12:00 AM

We have extended our coverage of fundamental data points by adding items such as EBITDA Margin, Free Cash Flow, and many more. And we have extended the available history for old and new fundamental items as far back as 2004 March.

The full list of available items is shown below:


Split Adjusted but not Dividend Adjusted

Posted by Profitspi Admin at 12/10/2015 12:00 AM

Just a reminder that on Profitspi.com our price history is adjusted for splits but we do not adjust for cash dividends.

The reason we do not adjust for dividends is so that the prices you see on trade entry and exit in backtesting reflect the actual prices on the dates in question.

And when comparing our price history to other sites which do adjust their charts etc for dividends, please be aware that there will be price differences for stocks that issue dividends.


Copy and Paste Criteria

Posted by Profitspi Admin at 10/4/2015 12:00 AM

You can now copy criteria from a screen or backtest and paste it to another screen or backtest.

As shown below, just click the 'Copy Criteria' option at the bottom of the criteria, navigate to the destination screen or backtest and use the 'Paste Criteria' option, which will show next to the Copy, to copy the criteria across.


Site Grids Updated

Posted by Profitspi Admin at 9/14/2015 12:00 AM

We have removed some legacy code from the site grids. This has reduced the size of our pages and should improve response times.

The grids should function the same way as before but if you do encounter any issue please contact us.


Continuous Futures Contracts

Posted by Profitspi Admin at 6/3/2015 12:00 AM

We now provide data for a wide selection of Futures. Futures contracts typical trade for relatively short time-periods but by chaining together the individual contracts we can create a long-term price history for backtesting, charting and any other purpose.

For example, it is possible to trade WTI futures for many different contract months as follows:

WTI May

WTI June

WTI July

etc

In this case May is the prompt or #1 contract for WTI, June is #2 and so on.

But once May has expired June becomes #1, July is #2 and so on.

By applying a combination of Roll Date Rules and Price Adjustment Rules we can use these short term histories to create a series of long term price histories such as:

WTI Futures #1 Roll Last Trading Day Unadjusted

WTI Futures #1 Roll Open Interest Backwards Panama Adjusted

and so on for 12 other combinations as detailed further below.

Roll Date Rules

On the last trading day of the expiring contract: this method is called the last-trading-day or end-to-end roll method. This method allows you to use the front contract for as long as possible; however the danger is that activity may have switched to the back contract prior to your roll. A trading strategy based upon this rule runs the risk of unwanted delivery and/or close-out of your positions, if you do not roll in time (the margin for error is very limited).

On the first day of the contract delivery month or on the contract end date, whichever is sooner: this is called the first-of-month roll method, and is used by most major data terminals as their default roll method. It has the advantage that it is uniform across all contracts, and completely predictable. However, this method has very little connection with the underlying mechanics of the contract; it is connected neither to the contract's trading activity, nor to its specific delivery rules. We recommend using this method only for purely deterministic trading strategies which do not rely on behavioral patterns for their returns.

On the first day that the back contract has a higher open interest than the front contract: this is called the open-interest-switch or liquidity-based roll method, and is used by most technical traders, especially in financial futures. It is also used by macro traders who are primarily concerned with larger longer-term trends, and are hence agnostic to minor differences in valuation within a given commodity complex. This roll rule, by definition, offers the highest liquidity to traders. However, note that it is completely inappropriate for interest rates futures, and should be used with care for energy and agriculture futures.

Price Adjustment Rules

No price adjustment: the simplest choice. The prices you see are always actual transaction prices; however, there are discontinuous jumps in the long-term futures price history.

Forwards panama canal method: aka first-true method. Shift successive contracts up or down by a constant amount so as to eliminate jumps, working forwards from the oldest contract in your history. The price of the oldest contract will therefore be "true"; all others will be adjusted.

Backwards panama canal method: aka last-true method. Shift successive contracts up or down by a constant amount so as to eliminate jumps, working backwards from the current contract. The price of the current continuous contract will be "true" and match market prices; however, you will need to recalculate your entire history on every roll date, which may be impractical.

Backwards ratio method: instead of shifting contracts up or down, in this method we multiply contracts by a constant factor so as to eliminate jumps, working backwards from the current contract. As with the backwards panama canal method, this method necessitates full historical recalculation on every roll date.

Calendar-weighted method: transition smoothly from one contract to the next, by using blended or weighted-average combined prices during a pre-determined transition window right around the roll date. This method is an elegant compromise between first-true and last-true methods: like first-true, it requires no historical recalculation, and like last-true, it delivers continuous prices that exactly match current market prices. However, this method cannot be used in conjunction with non-predictable roll dates such as open-interest-switch.

Roll Date / Price Adjustment Combinations

With 3 roll rules and 5 price rules, there are 15 possible price / roll combinations;- minus 1, because calendar-weighted prices are incompatible with open-interest-switch rolling. So there are a total of 14 roll / price combinations available.

On this site futures symbol ids are appended with a suffix to denote the price/roll combination. For example, CL1-EN is used for NYMEX WTI futures contract, known by the identifier CL, for the prompt month, rolling on the last trading day, with no price adjustment.

All combinations are shown below. You can follow the link to your preferred combination and get a list of all contracts which you can then add to a watch list for easy use in backtesting, charting, etc.

 

Last Trading Day First Day of Month Open Interest Switch
Unadjusted Prices

-EN

Roll Last Trading Day Unadjusted Prices

-FN

Roll First of Month Unadjusted Prices

-ON

Roll on Open Interest Unadjusted Prices

Forwards Panama

-EF

Roll Last Trading Day Forwards Panama Adjusted

-FF

Roll First of Month Forwards Panama Adjusted

-OF

Roll on Open Interest Forwards Panama Adjusted

Backwards Panama

-EB

Roll Last Trading Day Backwards Panama Adjusted

-FB

Roll First of Month Backwards Panama Adjusted

-OB

Roll on Open Interest Backwards Panama Adjusted

Backwards Ratio

-ER

Roll Last Trading Day Backwards Ratio Adjusted

-FR

Roll First of Month Backwards Ratio Adjusted

-OR

Roll on Open Interest Backwards Ratio Adjusted

Calendar-Weighted

-EW

Roll Last Trading Day Calendar-Weighted Adjusted

-FW

Roll First of Month Calendar-Weighted Adjusted

N/A

How to Backtest a Dataset from Quandl.com

Posted by Profitspi Admin at 5/27/2015 4:00 AM

Our new Data Manager tool allows you to easily retrieve any dataset from Quandl.com and refresh that data when needed.

Data Manager

When you first view the Data Manager it will look similar to what is shown below:

First Time Retrieval

Now you just enter the Quandl code from Quandl.com, Eg ICE/BZ2015, and click 'Get Quandl Instrument(s)'. The API key is needed if you are making high use of Quandl data or need to access any premium dataset. Once the data is retrieved and updated the page should now look like this:

The Symbol Id has been stripped to 'BZ2015' and the retrieved history is shown in the bottom panel. You can use 'Edit Grid Data' to change the Symbol, Name, etc.

Access User Instruments via Backtesting, etc

When accessing your Instruments on any other part of the site the Symbol Ids are prefixed with '!' to identify them as User Instruments. So in this case you would use !BZ2015.

To run a Backtest against this Instrument just choose the Specific Symbol Id(,s) option on the Strategy Test panel as follows:

You could also create a Watch List of your Instruments and Test against that.

Refresh Data at a Later Date

On subsequent visits to the site, if you need your Instruments to be appended with any recent price activity, just go to the Data Manager page and click 'Refresh Quandl Data'. This function will check your Quandl related Instruments and append any recent price history found.


Backtest any Dataset on Quandl.com

Posted by Profitspi Admin at 5/21/2015 12:00 AM

You can now retrieve any dataset from Quandl.com for use in backtesting, charting, etc.

Just enter the appropriate Quandl code, Eg ICE/BZ2015 on the Data Manager page at http://www.profitspi.com/stock/view.aspx?v=data-manager.

A more detailed blog post will follow soon.


Additional Fundamentals

Posted by Profitspi Admin at 5/6/2015 10:00 AM

The following fundamental items are now available:

. Return on Average Equity

. Return on Average Assets

. Gross Margin

. EBITDA Margin

. Net Margin


Backtest any Instrument Online

Posted by Profitspi Admin at 5/4/2015 10:00 AM

You can now upload and maintain price history for any instrument and use those instruments in backtesting, charting, etc.

We currently provide data for US stocks so if you have stock history from another market or commodities, forex, etc you can now run backtests against those too.

Check out our new Data Manager tool.


Welcome to our New Blog

Posted by Profitspi Admin at 5/4/2015 9:00 AM

The Forum at Profitspi Classic has been discontinued as there is not so much traffic there now. Please check out this Blog page from time to time for information regarding the site.