EMA Indicators with BUY sell Signal

kgiap123 · study · 49 行 · 点赞 2,187 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

// *********************************************************************************
// Title : EMA Indicators with BUY sell Signal
// Author: KGYeo
// Description :-
//      1 - Combine EMA20, EMA50 and EMA200 into 1.
//      2 - Buy signal based on 20 Days Highest High resistance
//      3 - Sell signal based on 10 Days Lowest Low support
// Input :-
//      1 - Short EMA (20), Mid EMA (50) and Long EMA (200)
//      2 - Resistance (20) = 20 Days Highest High line
//      3 - Support (10) = 10 Days Lowest Low line
// *********************************************************************************
study(title="EMA Indicators with BUY sell Signal", shorttitle="Turtle Signal and EMA", overlay=true)
src = close, len = input(20, minval=1, title="Short EMA")
src2 = close, len2 = input(50, minval=1, title="Mid EMA")
src3 = close, len3 = input(200, minval=1, title="Long EMA")
src4 = close, R = input(20, minval=1, title="Resistance")
src5 = close, S = input(10, minval=1, title="Support")
 
emaShort = ema(src, len)
emaMid = ema(src2, len2)
emaLong1 = ema(src3, len3)
emaLong2 = ema(src3, len3+20)
emaLong3 = ema(src3, len3+40)
emaLong4 = ema(src3, len3+60)
 
 
p1 = plot(emaShort, title="EMA Short", style=line, linewidth=1, color=red)
p2 = plot(emaMid, title="EMA Mid", style=line, linewidth=3, color=green)
plot(emaLong1, title="EMA Long", style=line, linewidth=5, color=purple)
plot(emaLong2, title="EMA Long", style=line, linewidth=1, color=purple)
plot(emaLong3, title="EMA Long", style=line, linewidth=1, color=purple)
plot(emaLong4, title="EMA Long", style=line, linewidth=1, color=purple)
 
 
highestHigh = highest(high[1], R)
lowestLow = lowest(low[1], S)
 
Hdata = close > highestHigh
Ldata = close < lowestLow
plotshape(Hdata, style=shape.arrowup,text="Buy",
          location=location.abovebar, color=green)
plotshape(Ldata, style=shape.arrowdown,text="Sell",
          location=location.abovebar, color=red)
 
pHigh = plot(series=highestHigh, style=line, color=black)
pLow = plot(series=lowestLow, style=line, color=black)
 
fill(pHigh, pLow)

← 返回列表