MRK BUY SELL

mktrader963 · study · 75 行 · 点赞 24 · TradingView 原页

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

Pine Script

//@version=6
indicator("MRK BUY SELL", shorttitle="MRK BUY SELL", overlay=true, max_labels_count=500)
 
//====================================================
// SETTINGS
//====================================================
 
minStrength = input.float(70.0, "Minimum Body Strength %", step=1.0)
 
//====================================================
// BODY STRENGTH
//====================================================
 
candleRange = high - low
body = math.abs(close - open)
 
bodyStrength = candleRange > 0 ? (body / candleRange) * 100 : 0.0
 
//====================================================
// BUY / SELL CONDITIONS
//====================================================
 
buySignal = close > open and bodyStrength >= minStrength
sellSignal = close < open and bodyStrength >= minStrength
 
//====================================================
// BUY SIGNAL
//====================================================
 
if buySignal and barstate.isconfirmed
    label.new(
         bar_index,
         low,
         "BUY\n" + str.tostring(bodyStrength, "#.##") + "%",
         style=label.style_label_up,
         color=color.green,
         textcolor=color.white,
         size=size.normal
    )
 
//====================================================
// SELL SIGNAL
//====================================================
 
if sellSignal and barstate.isconfirmed
    label.new(
         bar_index,
         high,
         "SELL\n" + str.tostring(bodyStrength, "#.##") + "%",
         style=label.style_label_down,
         color=color.red,
         textcolor=color.white,
         size=size.normal
    )
 
//====================================================
// CURRENT CANDLE BODY STRENGTH
//====================================================
 
var label lbl = na
 
if barstate.islast
    label.delete(lbl)
 
    txt = "BODY STRENGTH = " + str.tostring(bodyStrength, "#.##") + "%"
 
    lbl := label.new(
         bar_index,
         high,
         txt,
         style=label.style_label_down,
         color=close >= open ? color.green : color.red,
         textcolor=color.white,
         size=size.normal
    )

← 返回列表