Strategy · Pine Script v6 · On the chart

youtube布欧量化策略-接针策略

by YooooungLee

This strategy buys after a sharp down bar with a long lower wick.

View on GitHub

Repaints

GitHub stars4on the repository
Pine versionv6current
Lines of code41
Settings4inputs
LicenceApache-2.0
Last update10 months ago29 Dec 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

41 lines of Pine Script v6 from Quant-code/strategy/布欧量化-接针策略.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

布欧量化-接针策略.pine
//@version=6
//@author=bilibili布欧&YooooungLee
// 接针策略
// https://www.bilibili.com/video/BV1hJ4m1L7St/?spm_id_from=333.1387.upload.video_card.click&vd_source=2259e9234c14f43f66f1f2a15c85914b

strategy("youtube布欧量化策略-接针策略", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// 定义下影线与实体的比较条件
pinBarThreshold = input.float(100, title = "针占箱体的比例(%)", minval = 0.01, step = 0.1)
downRate = input.float(1, title = "下跌幅度(%)", minval = 0.01, step = 0.01)
tp = input.float(102, title = "止盈比例(%)", minval = 0.01, step = 0.01)
sp = input.float(95, title = "止损比例(%)", minval = 0.01, step = 0.01)

// 计算实体和下影线的高度
bodysize = math.abs(close - open)
lowerwicksize = low - math.min(open, close)
lowerwicksizeabs = math.abs(lowerwicksize)

// 判断是否为接针 (下影线大于实体部分的比例x) boolean类型
w1 = lowerwicksizeabs > bodysize * pinBarThreshold / 100

// 计算涨跌幅 ta.roc(close, 1) 表示当前收盘价与前一根k线收盘价之间的百分比变化(即涨跌幅),d是百分比值
d = ta.roc(close, 1)

// 跌幅超过downRate,True 【也可以设置为其他值】
w2 = d < -1 * downRate

// --------策略----------
if w1 and w2  //w1 影线大于实体部分 and w2 跌幅超过1
    // 开仓
    strategy.entry("接针", strategy.long, comment = "接针")

if strategy.opentrades > 0  // 若未平仓交易数量大于0
    // 计算止盈价格:开仓价格乘以止盈比例,考虑到手续费影响,使用position_avg_price
    takeProfitPrice = strategy.position_avg_price * tp / 100
    // 计算止损价格:开仓价格乘以止损比例(这里为95%),考虑到手续费影响,使用position_avg_price
    stopLossPrice = strategy.position_avg_price * sp / 100
    // 设置止盈条件
    strategy.exit("抽离", "接针", limit = takeProfitPrice,stop = stopLossPrice ,comment = "抽离")

// 注意:本策略未包含退出的条件,实际应用中,还需要添加额外的止盈和止损条件

Overview

youtube布欧量化策略-接针策略 opens one long when the lower wick exceeds the candle body by the pin-bar ratio and the one-bar close change falls past the decline threshold. Size defaults to the full account equity. While a trade is open, it places a limit exit and a stop from the average entry price using the take-profit and stop-loss percentages. Everything is evaluated on the price chart. Conditions use the forming bar, so they can change before that bar closes.

Details

Published by

YooooungLee on GitHub

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
针占箱体的比例(%)float100pinBarThreshold
下跌幅度(%)float1downRate
止盈比例(%)float102tp
止损比例(%)float95sp
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

330 stars

Exceeded Candle [Alorse] is a mean-reversion strategy that identifies candlestick engulfing patterns combined with Bollinger Bands filters. It enters a long position when a green candle surpasses the body of the previous red candle while price is below the mid

Strategy v4 Mean reversionCandlestick patterns
Updated 2 months ago · None stated GitHub repository of Exceeded candle [Alorse]
285 stars

Mean Reversion Strategy is an overlay strategy that identifies pullbacks using a long-term EMA, RSI, and candlestick patterns. It generates long signals when a bullish engulfing candle forms below the EMA while RSI is oversold, and short signals when a bearish

Strategy v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Strategy

STRG One Bar Pursuit

by harryguiacorn
220 stars

The STRG One Bar Pursuit strategy identifies single-bar momentum reversals by monitoring shifts between bullish and bearish candlesticks starting from the year 2024. It enters a long position when a bullish candle follows a bearish candle and enters a short po

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of STRG One Bar Pursuit

A Strategy for Leledec

by hasnocool
106 stars

This Pine Script strategy identifies major and minor Leledec exhaustion bars by tracking consecutive price bar comparisons against past closes and checking local extremes over set lookback lengths. It overlays visual markers directly on the price chart for det

Strategy v4 Mean reversionCandlestick patterns
Updated 2 years ago · GPL-3.0 GitHub repository of A Strategy for Leledec

BodyOutlier A003

by ruckard
13 stars

BodyOutlier A003 is a mean-reversion trading strategy designed for automated execution via Zignaly alerts. It identifies candlestick body outliers to place limit orders, buying at the low of unusually large bullish candles or selling at the high of large beari

Strategy v5 Candlestick patternsMean reversion
Updated 1 year ago · None stated GitHub repository of BodyOutlier A003

Markov Strategy

by Rohanom
9 stars

Markov Strategy is a mean-reversion quantitative strategy inspired by streak-based Markov chain analysis. Applied directly to the price chart, it monitors price action for consecutive downward closes. The strategy enters a long position after detecting six con

Strategy v5 Mean reversionCandlestick patterns
Updated 1 year ago · MIT GitHub repository of Markov Strategy

More Candlestick patterns scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers