0% found this document useful (0 votes)
20 views3 pages

Ao

This document contains two Pine scripts for plotting the Awesome Oscillator (AO) indicator and identifying bullish and bearish signals. The first script defines inputs for fast and slow SMA lengths and plots the AO as the difference between the two SMAs. The second script enhances the first by adding logic to identify regular and hidden bullish and bearish signals based on the AO and price action. Color-coded shapes are plotted at pivot points to label the signals.

Uploaded by

mehmetceren837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Ao

This document contains two Pine scripts for plotting the Awesome Oscillator (AO) indicator and identifying bullish and bearish signals. The first script defines inputs for fast and slow SMA lengths and plots the AO as the difference between the two SMAs. The second script enhances the first by adding logic to identify regular and hidden bullish and bearish signals based on the AO and price action. Color-coded shapes are plotted at pivot points to label the signals.

Uploaded by

mehmetceren837
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

//@version=5

// Copyright (c) 2018-present, Alex Orekhov (everget)


// Awesome Oscillator script may be freely distributed under the MIT license.
indicator('Awesome Oscillator', shorttitle='AO')

fastLength = input(title='Fast Length', defval=5)


slowLength = input(title='Slow Length', defval=34)

aom = ta.sma(hl2, fastLength) - ta.sma(hl2, slowLength)

aomColor = aom >= 0 ? aom[1] < aom ? #26A69A : #B2DFDB : aom[1] < aom ? #FFCDD2 :
#EF5350
plot(aom, title='AO', style=plot.style_columns, color=aomColor)

/////////////////////

ao_fast = input(5, 'AO Fast SMA Lenth')


ao_slow = input(34, 'AO Slow SMA Length')
src = input(title='LRS Source', defval=hl2)
lbR = input(title='Pivot Lookback Right', defval=5)
lbL = input(title='Pivot Lookback Left', defval=5)
rangeUpper = input(title='Max of Lookback Range', defval=60)
rangeLower = input(title='Min of Lookback Range', defval=5)
plotBull = input(title='Plot Bullish', defval=true)
plotHiddenBull = input(title='Plot Hidden Bullish', defval=true)
plotBear = input(title='Plot Bearish', defval=true)
plotHiddenBear = input(title='Plot Hidden Bearish', defval=true)

bearColor = color.red
bullColor = color.navy
hiddenBullColor = color.new(color.yellow, 50)
hiddenBearColor = color.new(color.yellow, 50)
textColor = color.white
noneColor = color.new(color.white, 100)

ao = ta.sma(src, ao_fast) - ta.sma(src, ao_slow)

hline(0)
plot(ao, color=color.new(color.aqua, 0), style=plot.style_line, linewidth=2)
osc = ao

plFound = na(ta.pivotlow(osc, lbL, lbR)) ? false : true


phFound = na(ta.pivothigh(osc, lbL, lbR)) ? false : true

_inRange(cond) =>
bars = ta.barssince(cond == true)
rangeLower <= bars and bars <= rangeUpper

//------------------------------------------------------------------------------
// Regular Bullish

// Osc: Higher Low


oscHL = osc[lbR] > ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Lower Low


priceLL = low[lbR] < ta.valuewhen(plFound, low[lbR], 1)
bullCond = plotBull and priceLL and oscHL and plFound

plot(plFound ? osc[lbR] : na, offset=-lbR, title='Regular Bullish', linewidth=2,


color=bullCond ? bullColor : noneColor, transp=0)

plotshape(bullCond ? osc[lbR] : na, offset=-lbR, title='Regular Bullish Label',


text='D', style=shape.labelup, location=location.absolute,
color=color.new(bullColor, 0), textcolor=color.new(textColor, 0))

//------------------------------------------------------------------------------
// Hidden Bullish

// Osc: Lower Low


oscLL = osc[lbR] < ta.valuewhen(plFound, osc[lbR], 1) and _inRange(plFound[1])

// Price: Higher Low


priceHL = low[lbR] > ta.valuewhen(plFound, low[lbR], 1)

hiddenBullCond = plotHiddenBull and priceHL and oscLL and plFound

plot(plFound ? osc[lbR] : na, offset=-lbR, title='Hidden Bullish', linewidth=2,


color=hiddenBullCond ? hiddenBullColor : noneColor, transp=0)

plotshape(hiddenBullCond ? osc[lbR] : na, offset=-lbR, title='Hidden Bullish


Label', text='H', style=shape.labelup, location=location.absolute,
color=color.new(bullColor, 0), textcolor=color.new(textColor, 0))

//------------------------------------------------------------------------------
// Regular Bearish

// Osc: Lower High


oscLH = osc[lbR] < ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Higher High


priceHH = high[lbR] > ta.valuewhen(phFound, high[lbR], 1)

bearCond = plotBear and priceHH and oscLH and phFound

plot(phFound ? osc[lbR] : na, offset=-lbR, title='Regular Bearish', linewidth=2,


color=bearCond ? bearColor : noneColor, transp=0)

plotshape(bearCond ? osc[lbR] : na, offset=-lbR, title='Regular Bearish Label',


text='D', style=shape.labeldown, location=location.absolute,
color=color.new(bearColor, 0), textcolor=color.new(textColor, 0))

//------------------------------------------------------------------------------
// Hidden Bearish

// Osc: Higher High


oscHH = osc[lbR] > ta.valuewhen(phFound, osc[lbR], 1) and _inRange(phFound[1])

// Price: Lower High


priceLH = high[lbR] < ta.valuewhen(phFound, high[lbR], 1)

hiddenBearCond = plotHiddenBear and priceLH and oscHH and phFound

plot(phFound ? osc[lbR] : na, offset=-lbR, title='Hidden Bearish', linewidth=2,


color=hiddenBearCond ? hiddenBearColor : noneColor, transp=0)
plotshape(hiddenBearCond ? osc[lbR] : na, offset=-lbR, title='Hidden Bearish
Label', text='H', style=shape.labeldown, location=location.absolute,
color=color.new(bearColor, 0), textcolor=color.new(textColor, 0))

You might also like