RSI Momentum Trend

TZack88 · study · 52 行 · 点赞 4,212 · TradingView 原页

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

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © TZack88
 
//@version=5
indicator('RSI Momentum Trend', overlay=true)
 
// ** ---> Inputs ------------- {
var bool positive       = false
var bool negative       = false
string RSI_group        = "RSI Settings"
string mom_group        = "Momentum Vales"
string visual           = "Visuals" 
int Len2                = input(14,"RSI 1️⃣",inline = "rsi",group = RSI_group)
int pmom                = input(65," Positive above",inline = "rsi1",group =RSI_group )
int nmom                = input(32,"Negative below",inline = "rsi1",group =RSI_group )
bool showlabels         = input(true,"Show Momentum ❓",inline = "001",group =visual )
color p                 = input(color.rgb(76, 175, 79, 62),"Positive",inline = "001",group =visual )
color n                 = input(color.rgb(255, 82, 82, 66),"Negative",inline = "001",group =visual )
bool filleshow          = input(true,"Show highlighter ❓",inline = "002",group =visual )
color bull              = input(color.rgb(76, 175, 79, 62),"Bull",inline = "002",group =visual )
color bear              = input(color.rgb(255, 82, 82, 66),"Bear",inline = "002",group =visual )
rsi                     = ta.rsi(close, Len2)
//------------------- }
 
// ** ---> Momentums ------------- {
 
p_mom               = rsi[1] < pmom and rsi > pmom and rsi > nmom and ta.change(ta.ema(close,5)) > 0
n_mom               = rsi < nmom and ta.change(ta.ema(close,5)) < 0
if p_mom
    positive:= true
    negative:= false
 
if n_mom
    positive:= false
    negative:= true     
 
// ** ---> Entry Conditions ------------- {
 
a = plot(filleshow ? ta.ema(high,5) : na,display = display.none,editable = false)
b = plot(filleshow ? ta.ema(low,10) : na,style = plot.style_stepline,color = color.red,display = display.none,editable = false)
 
// fill(a,b,color = color.from_gradient(rsi14,35,pmom,color.rgb(255, 82, 82, 66),color.rgb(76, 175, 79, 64)) )
fill(a,b,color = positive ? bull :bear ,editable = false)
 
//plotting 
pcondition = positive and not positive[1]
ncondition2 = negative and not negative[1]
plotshape(showlabels ? pcondition: na , title="Positive Signal",style=shape.labelup, color=p, location= location.belowbar , size=size.tiny,text= "Positive",textcolor = color.white)
plotshape(showlabels ? ncondition2: na , title="Negative Signal",style=shape.labeldown, color=n, location= location.abovebar , size=size.tiny,text = "Negative",textcolor = color.white)
 
alertcondition(pcondition,"Positive Trend")
alertcondition(ncondition2,"Negative Trend")

← 返回列表