TRADERS TIPS August 2008
Post on: 18 Июнь, 2015 No Comment
Here is this month’s selection of Traders’ Tips, contributed by various developers of technical analysis software to help readers more easily implement some of the strategies presented in this and other issues.
You can copy these formulas and programs for easy use in your spreadsheet or analysis software. Simply select the desired text by highlighting as you would in any word processing program, then use your standard key command for copy or choose copy from the browser menu. The copied text can then be pasted into any open spreadsheet or other software by selecting an insertion point and executing a paste command. By toggling back and forth between an application window and the open Web page, data can be transferred with ease.
Editor’s note: This month’s Traders’ Tips are based on Lee Leibfarth’s article in this issue, Premier Stochastic Oscillator.
Code for TradeStation is already provided in Leibfarth’s article. Additional EasyLanguage code contributed by TradeStation is presented here.
Readers will find our Traders’ Tips section in its entirety at the STOCKS & COMMODITIES website at www.Traders.com in the Traders’ Tips area, from where the code can be copied and pasted into the appropriate program. In addition, the code for each program is usually available at the respective software company’s website. Thus, no retyping of code is required for Internet users.
For subscribers, the EasyLanguage code found in Leibfarth’s article in this issue can be copied and pasted into TradeStation from the Subscriber Area at www.Traders.com. Login is required.
TRADESTATION: PREMIER STOCHASTIC OSCILLATOR
Lee Leibfarth’s article in this issue, Premier Stochastic Oscillator, describes an update to the classic stochastic indicator. We have developed EasyLanguage code to allow this indicator to be applied to a list of symbols in a RadarScreen window.
FIGURE 1: TRADESTATION, PREMIER STOCHASTIC OSCILLATOR. Here is a demonstration of the PremierStochasticRS indicator applied to a list of symbols in RadarScreen (left). Green cells indicate a cross down through a trigger line. A red cell denotes a cross up through a trigger line. A chart of BHI with the premier stochastic indicator applied is also shown (right). The chart uses different EasyLanguage code than the RadarScreen, but the calculations are the same. The premier stochastic strategy is running on the BHI chart. A cross down took place on the previous bar, so a long entry is visible on the current bar. The indicator code highlights indicator crosses of various trigger lines. When the indicator crosses down through a trigger line, the background of the RadarScreen cell for the associated symbol turns a shade of green. When the indicator crosses up through a trigger line, the background color of the cell for that symbol turns a shade of red.
To download the EasyLanguage code for this study and for the original premier stochastic oscillator indicator and strategy, go to the TradeStation and EasyLanguage Support Forum (https://www.tradestation.com/Discussions/forum.aspx?Forum_ID=213). Search for the file LeibfarthPremier.Eld.
This article is for informational purposes. No type of trading or investment recommendation, advice, or strategy is being made, given, or in any manner provided by TradeStation Securities or its affiliates.
—Mark Mills
TradeStation Securities, Inc.
A subsidiary of TradeStation Group, Inc.
www.TradeStation.com
WEALTH-LAB: PREMIER STOCHASTIC OSCILLATOR
Here is the C# code that implements the premier stochastic oscillator (PSO), as described in Lee Leibfarth’s article in this issue, in Wealth-Lab Developer 5.1.
We’ve set up a system with entries triggered by the premier stochastic oscillator and a pair of percentage-based profit target and stop-loss exits. Following Leibfarth’s guidelines on keeping the reward/risk ratio, a profit target by default is twice the size of the stop-loss — but you can interactively configure all of them by simply dragging the parameter sliders (see the lower-left corner of Figure 2).
FIGURE 2: WEALTH-LAB, PREMIER STOCHASTIC OSCILLATOR. The premier stochastic oscillator turned out to be a timely countertrend technique. A test of this strategy on a portfolio of liquid ETFs revealed its profitability without optimization, and the drawdown was quite moderate (Figure 3).
FIGURE 3: WEALTH-LAB, PROFIT. Here is a combined view of net profit and drawdown (%) from the premier stochastic strategy in WL Developer 5.1.
—Eugene
www.wealth-lab.com
eSIGNAL: PREMIER STOCHASTIC OSCILLATOR
For this month’s Traders’ Tip, we’ve provided the formulas PremierStochastic.efs and Pso_Strategy.efs, based on the formula code from Lee Leibfarth’s article in this issue, Premier Stochastic Oscillator.
Both studies contain formula parameters that may be configured through the Edit Studies option to set the values for stochastic length, period, line 1, and line 2. The Pso_Strategy.efs study is also back-testing compatible and contains two additional formula parameters for the profit target and stop-loss percentages, which have been set at defaults of 3.0% and 1.5%, respectively.
The strategy formula draws labels on the indicator pane to highlight the entry and exit trades. The LE and SE labels represent long and short entry trades. LT, LS, ST, and SS represent the profit target and stop exit trades. See Figures 4 and 5.
FIGURE 4: eSIGNAL, PREMIER STOCHASTIC OSCILLATOR. This eSignal chart shows the premier stochastic oscillator indicator, PremierStochastic.efs, on a daily chart of ES #F.
FIGURE 5: eSIGNAL, PREMIER STOCHASTIC STRATEGY. This eSignal chart shows the premier stochastic strategy, PSO_Strategy.efs, on a daily chart of ES #F. To discuss this study or download a complete copy of the formula code, please visit the EFS Library Discussion Board forum under the Forums link at www.esignalcentral.com or visit our Efs KnowledgeBase at www.esignalcentral.com/support/kb/efs/. The eSignal formula scripts (EFS) are also available for copying and pasting from the STOCKS & COMMODITIES website at Traders.com. —Jason Keck
eSignal, a division of Interactive Data Corp.
800 815-8256, www.esignalcentral.com
AMIBROKER: PREMIER STOCHASTIC OSCILLATOR
In Premier Stochastic Oscillator in this issue, Lee Leibfarth presents a fast-reacting indicator derived from the classic stochastic indicator.
Implementing the premier stochastic indicator using the AmiBroker Formula Language is straightforward.
Listing 1 shows a ready-to-use formula consisting of both the indicator and trading system. To use it, simply enter the code into the Formula Editor, then choose the Tools->Apply Indicator menu from the editor. To backtest the trading system, use the Tools->Backtest menu from the editor.
Please be sure to enable long and short positions in the Automatic Analysis Settings screen. You may use the Parameters window (available from the right-click menu) to adjust the stochastic and smoothing periods.
To display entry and exit arrows, click with the right-mouse button over the backtest trade list and choose Show arrows for actual trades. See Figure 6.
FIGURE 6: AMIBROKER, PREMIER STOCHASTIC INDICATOR. This AmiBroker chart shows a daily chart of ER2 (upper pane) with trade arrows, the premier stochastic indicator (middle pane), and system equity in the bottom pane, replicating the chart from Leibfarth’s article. —Tomasz Janeczko
www.amibroker.com
METASTOCK: PREMIER STOCHASTIC OSCILLATOR
In Premier Stochastic Oscillator in this issue, Lee Leibfarth describes the calculation of his new indicator and a system using it. The MetaStock formulas and instructions for adding them to MetaStock follow.
To enter the indicators into MetaStock:
—William Golson
Equis International
NEUROSHELL TRADER: PREMIER STOCHASTIC OSCILLATOR
The premier stochastic indicator and trading system described in Lee Leibfarth’s article in this issue can be easily implemented in NeuroShell Trader by combining a few of NeuroShell Trader’s 800+ indicators. See Figure 7.
FIGURE 7: NEUROSHELL TRADER, PREMIER STOCHASTIC INDICATOR. Here is a sample NeuroShell Trader chart showing the premier stochastic on the emini Russell 2000. To recreate the premier stochastic indicator, select New Indicator. from the Insert menu and use the Indicator Wizard to set up the following indicators:
To recreate Leibfarth’s trading system based on his premier stochastic indicator, select New Trading Strategy. from the Insert menu and enter the following in the appropriate locations of the Trading Strategy Wizard:
If you have NeuroShell Trader Professional, you can also choose whether the system parameters should be optimized. After backtesting the trading strategy, use the Detailed Analysis. button to view the backtest and trade-by-trade statistics for the premier stochastic strategy.
—Marge Sherald, Ward Systems Group, Inc.
301 662-7950, sales@wardsystems.com
www.neuroshell.com
WORDEN BROTHERS BLOCKS: PREMIER STOCHASTIC OSCILLATOR
Note: To use the indicators and charts in this Traders’ Tip, you will need the free Blocks software. Go to www.Blocks.com to download the software and get detailed information on the available datapacks.
The indicator presented by Lee Leibfarth in his article in this issue, Premier Stochastic Oscillator, is available in the Blocks Trader indicator library. To load the indicator, click the Indicators button, click on the SC Traders’ Tips folder, then click on premier stochastic oscillator and drag it onto the chart (Figure 8).
FIGURE 8: BLOCKS, PREMIER STOCHASTIC OSCILLATOR. Here is a demonstration of the premier stochastic oscillator (white) with entry thresholds (blue and red). For more information and to view Blocks tutorial videos, go to www.Blocks.com.
— Patrick Argo and Bruce Loebrich
Worden Brothers, Inc.
STRATASEARCH: PREMIER STOCHASTIC OSCILLATOR
The stochastic oscillator has been around for a long time and is used in many different forms. But this enhanced version, presented by Lee Leibfarth in his article in this issue, Premier Stochastic Oscillator, with its unique implementation, appears to provide some equally unique benefits. See Figure 9 for an example of the indicator implemented in StrataSearch.
FIGURE 9: STRATASEARCH, PREMIER STOCHASTIC OSCILLATOR. Buy signals are triggered when the PSO drops below 0.90, and sell signals are triggered when the price target is reached, or upon hitting the stop. As a test, we set up the premier stochastic oscillator (PSO) with the same parameters used in the article, namely an eight-day stochastic length, with a 25-day period. We then created variables for the profit target and the stop-loss, with the stop- loss always being 50% of the profit target. Run against four years of the NASDAQ 100 component stocks, there were certainly some results that proved quite promising. However, we then ran the best performer of that group against 250 different sectors. Interestingly, 200 out of the 250 sectors were profitable using the PSO. Thus, the benefits of this indicator appear to carry over to multiple markets.
While the profit target and stop-loss method of exit often created profitable systems, this indicator may prove most helpful when used as a supporting indicator alongside other trading rules. This can be tested quite easily in StrataSearch by configuring the PSO as a supporting trading rule that is always in use, and then running an automated search to test a variety of trading rule combinations.
As with all other Traders’ Tips, additional information — including plug-ins — can be found in the Shared Area of the StrataSearch user forum. This month’s plug-in contains a number of prebuilt trading rules that will allow you to include this indicator in your automated searches. Simply install the plug-in and let StrataSearch identify the benefits of using this indicator alongside other trading rules.
—Pete Rast
Avarin Systems Inc.
www.StrataSearch.com
AIQ: PREMIER STOCHASTIC OSCILLATOR
The AIQ code for Lee Leibfarth’s article, Premier Stochastic Oscillator, is shown here. I ran simulations using the Nasdaq 100 list of stocks. To run tests on a portfolio level, I had to add trade selection rules, capitalization rules, and I modified the exits to work with stocks. However, the entry signals are exactly as described by the author in the article. The trades were selected using 30-day AIQ relative strength, taking the top two strongest signals per day, 20% of capital per position, with a maximum of five open positions. Positions were exited on any one of the following conditions: 1) a profit protect exit of 100% protection on profits over 4%, 2) a five-day time exit, 3) a reversing signal, or 4) a 25% disaster stop-loss.
I was curious as to whether the new indicator would outperform a standard smoothed stochastic using the same parameters. I ran comparative tests over the last 10 years using the same list of stocks and the same exit conditions, with the difference being the indicator driving the entries. On the long-only test comparison, shown in Figure 10, the PSO system significantly outperformed the SK-SD system on all the various metrics. However, the short side?only test comparison (not shown) was worse using the PSO. For both systems, shorting the NASDAQ 100 stocks worked only during short bear periods, while both lost horribly during the rest of the 10-year period. Both of the systems need market timing and/or trend filters to make the short side work. A trend filter might reduce the drawdown from the long side as well.
FIGURE 10: AIQ, PREMIER STOCHASTIC STRATEGY. Here is a comparison of the PSO and SK_SD systems (long only). The PSO significantly outperformed the SK_SD in a portfolio simulation trading the NASDAQ 100 stocks. The code can be downloaded from the AIQ website at www.aiqsystems.com and also from www.tradersedge systems.com/traderstips.htm.
—Richard Denning, AIQ Systems
richard.denning@earthlink.net
TD Ameritrade: PREMIER STOCHASTIC OSCILLATOR
In his article in this issue, Lee Leibfarth discusses a variation of the stochastic oscillator. Here is an interpretation of Leibfarth’s premier stochastic oscillator (PSO) using TD Ameritrade’s StrategyDesk.
In his article, Leibfarth applies smoothing techniques to a normal stochastic oscillator to reduce the volatility and provide a more even depiction of the changes in the market. To recreate this as a custom chart indicator in StrategyDesk (Figure 11), use the following formula:
FIGURE 11: TD AMERITRADE, PREMIER STOCHASTIC STRATEGY. The price chart reflects two entry points based on the TD Ameritrade formula (annotated by the arrows). The PSO in the bottom pane falls below 0.90 (the upper black line), which is what triggers the entry signals in this example.
The author suggests using downside crossovers of the 0.90 and 0.20 levels as entry points for long trades, and upside crossovers of the -0.90 and -0.20 levels as entry points for short trades. The following entry formula is an example of the crossover from above 0.90 to below. The crossover point can be modified simply by changing the values in the formula from 0.90 to 0.20, and so on.
Keep in mind that using this as an upside crossover will not only necessitate changing the values from positive to negative values, but also changing the signs in the formula from greater than to less than and from less than to greater than. This formula can be used for either backtesting or program trading.
If you have questions about this formula or functionality, please call TD Ameritrade’s StrategyDesk help line at 800 228-8056, free of charge, or access the Help Center via the StrategyDesk application. StrategyDesk is a downloadable application free for all TD Ameritrade clients. Regular commission rates apply.
TD Ameritrade and StrategyDesk do not endorse or recommend any particular trading strategy. —Jeff Anderson
TD Ameritrade Holding Corp.
www.tdameritrade.com
CQG: PREMIER STOCHASTIC OSCILLATOR
Here is a CQG custom study definition for Lee Leibfarth’s article in this issue, Premier Stochastic Oscillator.
www.cqg.com/Support/Downloads.aspx) to install this study in CQG. The code is also shown below. A sample chart is shown in Figure 12.
FIGURE 12: CQG, PREMIER STOCHASTIC STRATEGY
—Thom Hartle
www.CQG.com
ASPEN RESEARCH: PREMIER STOCHASTIC OSCILLATOR
Lee Leibfarth’s premier stochastic oscillator (PSO) can be easily replicated in Aspen Graphics. We have created supporting formulas to provide a variety of visual alerts to favorable conditions indicated by the premier stochastic oscillator. Also included are formulas for calculating appropriate stop-loss and profit-taking targets.
A sample chart is shown in Figure 13.
FIGURE 13: ASPEN GRAPHICS, PREMIER STOCHASTIC SYSTEM The first step in Aspen is to create the root formulas. These formulas will be referenced by all the other formulas. This includes creating the premier stochastic oscillator’s normalized fast K line. The formulas NormStoch and PremierStochOsc produce the oscillator displayed as a histogram.
A sample chart of the premier stochastic oscillator color rule is shown in Figure 14.
FIGURE 14: ASPEN GRAPHICS, PREMIER STOCHASTIC COLOR RULE The formula PsoSystem is used to set up various methods for alerting users to favorable conditions. This includes the Aspen color rule and the text-on-chart alerts provided by the formula PsoOverlay. It is also used to calculate the stop-loss and profit target. The red dotted line represents the price at which a stop-loss should be executed. The green dotted line represents the price at which profits could be taken. The result is a complete trading system based on Lee Leibfarth’s article.
Note that the current day for these charts indicate a favorable opening for a long position, and appropriate stop-loss and profit-taking positions are included in the system.
The final set of formulas calculates the stop-loss and profit-taking points. After the formulas are added to a chart, be sure to modify the shares, profit, and stop parameters to match your desired position.
www.aspenres.com/forums/viewtopic.php?f=3&t=22.
aspenres.com.
—Jeremiah Adams
Aspen Research Group, Ltd.
800 359-1121, support@aspenres.com
aspenres.com
NEOTICKER: PREMIER STOCHASTIC OSCILLATOR
In the article Premier Stochastic Oscillator in this issue, author Lee Leibfarth presents a new indicator, the premier stochastic oscillator (PSO), and also shows long and short signals based on the Pso.
The premier stochastic oscillator (PSO) can be constructed using NeoTicker’s formula language, and signals can be tested using NeoTicker’s BacktestEZ indicator.
The PSO (Listing 1) has four parameters, according to the code in the article’s sidebar. Line 1 and Line 2 are the signal lines’ real values. Stoch Length is a slow K integer period number, and Period is an integer period number for the double-exponential moving average. The resulting indicator will plot Pso values in a new pane in a time chart (Figure 15).
FIGURE 15: NEOTICKER, PREMIER STOCHASTIC OSCILLATOR After getting the PSO formula indicator to work, use NeoTicker’s BacktestEZ to test trading ideas presented in the article. First, add the BacktestEZ indicator to a daily ER2 data series, then, at the long entry and short entry fields, enter the signal formula (Listing 2). These formulas use the built-in indicators crossaboveconst and crossbelowconst to detect crosses between the PSO and signal values: 0.9, 0.2, -0.9, and -0.2. Next, set dollar amounts for the target and stops in the corresponding parameter fields. After completing the setup, hit apply to run this system against ER2 daily data. An equity curve will be plotted.
To see detailed system statistics, right-click on system indicator to open the performance viewer (Figure 16).
—Kenneth Yuen, TickQuest Inc.
www.tickquest.com
TRADINGSOLUTIONS: PREMIER STOCHASTIC OSCILLATOR
In his article Premier Stochastic Oscillator in this issue, Lee Leibfarth presents a normalized and smoothed version of a short-period stochastic oscillator. This function is described below and is also available as a function file that can be downloaded from the TradingSolutions website (www.tradingsolutions.com) in the Free Systems section. As with many indicators, these functions could make good inputs to neural network predictions.
800 634-3327, 352 377-5144
www.tradingsolutions.com
INVESTOR/RT: PREMIER STOCHASTIC OSCILLATOR
The premier stochastic oscillator (PSO) presented by Lee Leibfarth in this article in this issue can be implemented easily in Investor/RT using a custom indicator with the following syntax:
where SlowD is the stochastics slow %D and is set up as seen in Figure 17, using an eight-period raw %K along with five-period fast %D and slow %D to apply the double-exponential smoothing effect.
FIGURE 17: SLOW D STOCHASTICS INDICATOR SETUP The resulting PSO custom indicator is drawn as both a histogram and two-color line in the lower pane of the chart in Figure 18.
A video on creating signal markers and custom indicators in Investor/RT can be found at www.linnsoft.com/videos/.
More information on Investor/RT’s implementation of the stochastics indicator can be found at www.linnsoft.com/tour/techind/stoc.htm.
—Chad Payne, Linn Software
info@linnsoft.com, www.linnsoft.com
METATRADER 4: PREMIER STOCHASTIC OSCILLATOR
Here is code for use in MetaTrader 4 based on the article Premier Stochastic Oscillator by Lee Leibfarth in this issue.
Readers can visit the MistigriFX.com website user forum at www.mistigri.net/Forum/viewforum.php?f=7 with any questions.
—Patrick Nouvion
MistigriFX.com, a div. of Mistigri.net
admin@mistigri.net
NINJATRADER: PREMIER STOCHASTIC OSCILLATOR
The premier stochastic oscillator as discussed in Premier Stochastic Oscillator by Lee Leibfarth in this issue is available for download at www.ninjatrader.com/SC/August08SC.zip.
Once downloaded, from within the NinjaTrader Control Center window, select the menu File > Utilities > Import NinjaScript and select the downloaded file. This indicator is for NinjaTrader version 6.5 or greater.
You can review the indicator’s source code by selecting the menu Tools > Edit NinjaScript > Indicator from within the NinjaTrader Control Center window and selecting PremierStochastic. See Figure 19.
FIGURE 19: NINJATRADER, PREMIER STOCHASTIC OSCILLATOR. Here is the PSO indicator on a one-minute chart of the S&P emini June contract. NinjaScript indicators are compiled DLLs that run native, not interpreted, which provides you with the highest performance possible.
—Raymond Deux, NinjaTrader, LLC
www.ninjatrader.com
MULTICHARTS: PREMIER STOCHASTIC OSCILLATOR
In this month’s Traders’ Tips, we’ll present code to delineate Lee Leibfarth’s premier stochastic oscillator (PSO) as well as a strategy based on this code using the strategy rules as defined by Leibfarth in the article.
The resulting oscillator and strategy in MultiCharts is demonstrated in Figure 20.
FIGURE 20: MULTICHARTS, PREMIER STOCHASTIC OSCILLATOR AND STRATEGY To discuss this article and download a complete copy of the formulas, please visit our discussion forum at forum.tssupport.com.
—Stanley Miller
TS SUPPORT, LLC
www.tssupport.com
VT TRADER: PREMIER STOCHASTIC OSCILLATOR
Lee Leibfarth’s article in this issue, Premier Stochastic Oscillator, introduces a new indicator, the premier stochastic oscillator (PSO). The PSO is a modified short-term stochastic oscillator that has been normalized around a centralized zero level.
FIGURE 21: VT TRADER, PSO INDICATOR. Here is the PSO indicator attached to EUR/USD 60-minute candle chart. Leibfarth mentions in the article that the PSO’s main strength is in identifying countertrend trading setups. Leibfarth also provided some basic entry rules for use with the PSO. Long entries can be taken when the PSO crosses below the 0.90 level or when the PSO crosses below the 0.20 level; short entries can be taken when the PSO crosses above the -0.90 level or when the PSO crosses above the -0.20 level.
We’ll be offering the premier stochastic oscillator indicator for download in our user forums. The VT Trader code and instructions for creating it are as follows:
To attach the indicator to a chart (Figure 21), click the right mouse button within the chart window and then select Add Indicator -> TASC — 08/2008 — Premier Stochastic Oscillator from the indicator list.
To learn more about VT Trader, please visit www.cmsfx.com.
—Chris Skidmore, CMS Forex
(866) 51-CMSFX, trading@cmsfx.com