Bill Williams Awesome Oscillator Strategy (Amibroker And Tradestation Code)
The original article can be found here.
The code in plain English:
- The 5-day RSI of Bill Williams Oscillator indicator must be above 60.
- The 5-day ADX must be less than 35.
- If 1 and 2 are true, then go long at the close.
- Sell at the close when the indicator crosses below 50.
The Amibroker code:
MedianPrice = (H + L )/2 ;
AwesomeIndicator= MA(MedianPrice,5) - MA(MedianPrice,25) ;
RSIindicator= RSIa(AwesomeIndicator,5) ;
Buy= Cross(rsiindicator,60) AND ADX(5)<35 ;
buyPrice=Close;
Sell= Cross(50,rsiindicator);
sellPrice=Close ;
Tradestation code:
{
Bill Williams Awesome Oscillator Strategy
https://www.quantifiedstrategies.com/lessons/bill-williams-awesome-oscillator-strategy-amibroker-code/
}
Inputs:
FastLookback(5),
SlowLookback(25),
RsiLookback(5),
AdxLookback(5),
BuyRsiTreshold(60),
BuyAdxTreshold(35),
SellRsiTreshold(50);
Vars:
MedianPrice(0),
AwesomeIndicator(0),
RSIindicator(0);
MedianPrice = (H + L )/2 ;
AwesomeIndicator= Average(MedianPrice, FastLookback) - Average(MedianPrice, SlowLookback);
RSIindicator= RSI(AwesomeIndicator, RsiLookback);
if RSIindicator cross over BuyRsiTreshold AND ADX(AdxLookback) < BuyAdxTreshold Then
buy this bar on close;
if RSIindicator cross under SellRsiTreshold Then
sell this bar on close;
