Muscle Up Those Averages (substitute article for AIQ)

 

Original article by Ajay Pankhania
AIQ Code by Richard Denning

The code for John Ehlers’ article is not provided for AIQ. Instead I substituted an article from the September 2013 Stocks and Commodities issue by Ajay Pankhania, “Muscle Up Those Averages”.

I thought this basic code might be useful to beginning AIQ Expert Design Studio users as it illustrates how to code multiple versions of the simple and the exponential moving averages as well as the MACD indicator. Also the simple moving average crossover system and the MACD crossover systems are coded.

EDS Code:

!MUSCLE UP THOSE AVERAGES
!Author: Ajay Pankhania, TASC Sept 2013
!Coded by: Richard Denning 11/10/2013
!www.TradersEdgeSystems.com

!INPUTS:
price is [close].
smaLen1 is 50.
smaLen2 is 200.
emaLen1 is 12.
emaLen2 is 26.
emaLen3 is 9.

!CODE FOR SIMPLE MOVING AVERAGE OF PRICE:
SMA1 is simpleavg(price,smaLen1).
SMA2 is simpleavg(price,smaLen2).

!CODE FOR CROSSOVER SYSTEM:
BuySMA if SMA1 > SMA2 and valrule(SMA1 < SMA2,1).
SellSMA if SMA1 < SMA2 and valrule(SMA1 > SMA2,1).

!CODE FOR EXPONENTIAL MOVING AVERAGES (FOR MACD):
EMA1 is expavg(price,emaLen1).
EMA2 is expavg(price,emaLen2).

!CODE FOR MACD:
Fast is EMA1 – EMA2.
Signal is expavg(Fast,emaLen3).

!CODE FOR MACD SYSTEM:
BuyMACD if Fast > Signal and valrule(Fast < Signal,1).
SellMACD if Fast < Signal and valrule(Fast > Signal,1).

en_USEnglish
en_USEnglish