RicardoSantos

[RS][GLAZ]chrislig 5day4 Oscillator V0

163 0 22
EXPERIMENTAL: Request for chrislig.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS][GLAZ]chrislig 5day4 Oscillator V0", shorttitle="[RS][GLAZ]chrislig 5d4O.V0",overlay=false)
//  ||---   Condition 1 : stock goes up or down 5x in a row
isup(lookback) => close[0+lookback] >= close[1+lookback] ? true : false
isdown(lookback) => close[0+lookback] <= close[1+lookback] ? true : false
condition1 = isup(0) and isup(1) and isup(2) and isup(3) and isup(4) ? 1 :
        isdown(0) and isdown(1) and isdown(2) and isdown(3) and isdown(4) ? -1 : 0
bgcolor(condition1 == 1 ? green : na)
bgcolor(condition1 == -1 ? maroon : na)
//  ||---   Condition 2 : high of the diference of MA(200) and close
ma1 = sma(close, 200)
diference = close-ma1
difmax = highest(diference, 200)
difmin = lowest(diference, 200)
condition2 = diference >= difmax ? 1 : diference <= difmin ? -1 : 0
//  ||---   Outputs
out1 = condition1 == 1 and condition2 == 1 ? true : false
out2 = condition1 == -1 and condition2 == -1 ? true : false
plotshape(out1, style=shape.triangleup, location=location.top, color=green, text="BUY")
plotshape(out2, style=shape.triangledown, location=location.bottom, color=maroon, text="SELL")
plot(diference, color=black)
plot(difmax, color=gray, style=circles, linewidth=2)
plot(difmin, color=gray, style=circles, linewidth=2)
hline(0, color=black)
//  ||---   Previous code:
//DV=sma(close,200)
//perc=abs(close-DV)/DV
//pp=highest(perc,200)
//bars=input(5)
//bindex=close>close[1] and bindex[1]<bars?nz(bindex[1])+1:1
//hh= close>close[1] and hh[1]>=bindex? nz(hh[1])+1:1
//ret=iff(hh>bindex,-1,na)
//plotarrow(ret)
//plot(DV)
//plot(perc)
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
Việt Nam
日本
한국
简体
繁體
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Priority Support Contact Support Ideas Published Followers Following Private Messages Chat Sign Out