Consulting | Custom Trading Systems
Built-In Indicators | Custom Indicators

April 2012 Stocks and Commodities Traders Tips

Setting Strategies With SwamiCharts :

AIQ Version:

Original article by John Ehlers and Ric Way
AIQ Code by Richard Denning

The AIQ code for David Garrard’s article , “Putting a Stop To It”, from the May 2011 issue, is provided at the web site noted below. Coding stops for back-testing can be daunting, especially the average true range (ATR) stops discussed by the author. I provide code for the following type of stops for both longs and shorts:

Percentage based stop loss
ATR based stop loss
Percentage based trailing exit
ATR based trailing stop exit

The exits can be combined by joining the rule names using the “and” keyword.

In my implementation of the ATR based stops, I lock the ATR at its value on the signal day (day before the entry day) to prevent the stop moving once the position is entered should the ATR value increase.

These stops can only be used for back-testing as they use the application fields of position values that are filed only upon running a back-test. The stop values have not been coded so as to be able to be displayed on an EDS custom report. To do so requires coding in the stock symbol and the entry price and this would likely be done only for actual trades.

EDS Code for Setting Strategies With SwamiCharts
(right click and choose Save As)


Traders Studio Version :

Original article by John Ehlers and Ric Way
Traders Studio Code by Richard Denning

The TradersStudio code for John Ehlers and Ric Way’s article , “Setting Strategies with Swami Charts”, is provided below. The following code files are provided in the download below:

  • Function: “EHLERS_CORONA_SWING(outputType)” computes the following values:
    • If outputType = 1 Then = DomCyc
    • If outputType = 2 Then = SPP
    • If outputType = 3 Then = Color1
    • If outputType = 4 Then = Color2
    • If outputType = 5 Then = Color3
    • If < 1 or > 5 then = CSN (default)
  • Indicator Plot: “EHLERS_CORONA_SWING_IND(plotType)” for displaying the Swing Output Types as follows:
    • If plotType = 1 displays the Dominant Cycle
    • If plotType = 2 displays SPP
    • If plotTypw = 3 displays the three color numbers R G B
  • Function: “EHLERS_MARKET_MODE(outputType)” computes the following values:
    • If outputType = 1 then = Mean
    • If outputType = 2 then = Fraction*AvgPeak
    • If outputType = 3 then = Fraction*AvgValley
  • Indicator Plot: “EHLERS_MARKET_MODE_IND()” for diplaying the three outputTypes from the Market Mode function.

Please note that I did not attempt to duplicate the Swami Charts as displayed in the article due to time constraints and only the code presented in the article has been converted to TradersStudio code. Ways to use this code are to be determined.

Traders Studio Code for Setting Strategies With SwamiCharts:
(right click and choose Save As)














Disclaimer | Privacy Policy | Contact Us | Spam Blocker | ©2009 Traders Edge Systems