이 전략은 K선을 식별하여 하미 램프의 램프 형태를 형성하고, SMA 평준선 판단과 결합하여 역전 거래한다. 하미 램프의 램프 형태가 발생하면, 상장 가격이 평준선 밖에서 있다면 거래 신호가 발생한다. 더 많은 신호를 상장선으로 하고, 공백 신호를 하장선으로 한다.
이 전략은 다음과 같은 원칙에 기초하고 있습니다.
개시 및 종전 가격 범위와 전체 상승률을 계산하여 해미 램프의 현황을 식별한다.
이전 K 선의 종결값이 현재 K 선의 최고 가격과 최저 가격보다 높거나 낮다는 판단을 함으로써 잘못된 신호를 피합니다.
상장 가격과 SMA 평균의 관계를 판단하여 역전 신호를 형성합니다.
하미 램프의 형상을 인식하고 조건이 충족될 때, 더하거나 공백 신호를 생성한다.
코드의 주요 단계는 다음과 같습니다.
SMA 평균을 계산합니다.
회로 판단 하미 램프의 형상
이전 K 라인 종료 가격과 현재 K 라인 최고 최저 가격의 관계를 판단
개폐 가격과 평균선 관계를 판단하고 반전 신호를 확인
신호 표시를 그리고, 출력으로 멀티 공백 신호를 만든다
이 전략은 다음과 같은 장점을 가지고 있습니다.
하미 램프의 형태는 명확하고 쉽게 알아볼 수 있다.
일선 필터링과 결합하여 잘못된 신호를 줄일 수 있다.
은 신호를 켜고, 명확하게 작동하십시오.
반전 거래 Capture 단선 트렌드.
다양한 시장 환경에 적응할 수 있는 유연한 변수 조정.
이 프로젝트의 핵심은, 새로운 사용자들에게 친근하고, 이해하기 쉽고, 실행하기 쉽습니다.
이 전략에는 몇 가지 위험도 있습니다.
단일 형식 의존성, 시장의 가짜 돌파구에 취약함.
하지만, 이 모든 것은 손실을 통제할 수 없는 막상 손실 장치가 없기 때문입니다.
잘못된 매개 변수 설정으로 인해 거래가 너무 빈번하게 이루어질 수 있습니다.
트렌드 판단과 결합하여 트렌드 시장에서 잘하지 않습니다.
효과는 매개 변수 최적화에 의존하며, 지속적인 최적화 테스트가 필요합니다.
대응방법:
다른 지표와 함께 필터링 신호.
“이번 대책은 더 많은 손실을 방지하고, 더 많은 위험을 통제할 수 있습니다.
최적화 매개 변수, 거래 빈도 제어
() 은 () 의 () 의 () 의 () 을 나타냅니다.
계속적으로 재검토를 통해 최적화하고, 정기적으로 효과를 점검한다.
이 전략은 다음과 같은 방법으로 계속 개선될 수 있습니다.
트래픽 필터링을 늘려서 가짜 침입을 방지합니다.
추가 손해 방지 메커니즘. 尾行停止,死叉停止 등.
시장 구조와 결합하여, 최적화 매개 변수. 트렌드, 조립 환경 매개 변수 구분.
다른 지표 확인 신호와 함께 . MACD, KDJ 등 .
트렌드 판단을 높이고 역대 거래를 피하십시오.
순환주기 파라미터를 최적화하고, FREQ와 신호 품질을 균형 잡는다.
이 전략은吊灯线形状을 결합하여 SMA均线判断을 통해 효율적인 역전 거래를 가능하게 한다. 신호 간결성, 조작 편의성 등의 장점이 있다. 또한 몇 가지 위험과 최적화 가능한 공간이 있다. 지속적인 최적화 테스트를 통해 이 전략은 효율적이고 안정적인 단선 거래 전략이 될 수 있다.
||
This strategy identifies doji candlestick patterns and combines SMA to determine reversals for trading. It generates trading signals when doji patterns form and the open/close prices are outside the SMA lines. Bullish signals are generated on hanging man lines and bearish signals on shooting star lines.
The main principles of this strategy are:
Identifying doji patterns by calculating the range of open/close prices vs the overall price movement.
Checking if previous close is above/below current high/low to avoid false signals.
Judging open/close prices in relation to SMA lines to generate reversal signals.
Generating long/short signals when qualified doji patterns are identified.
The main steps in the code are:
Calculating SMA lines
Looping through candles to identify doji patterns
Checking previous close vs current high/low relationship
Confirming reversal signals based on open/close and SMA relationship
Plotting signal markers and outputting long/short signals
The advantages of this strategy include:
Doji patterns are clear and easy to identify/implement.
SMA filters help reduce false signals.
Clear long/short signals make trading operations straightforward.
Reversal trading captures short-term trends.
Flexible parameters can adapt to different market conditions.
Easy to understand and implement, beginner friendly.
Some potential risks:
Reliance on single pattern, prone to false breakouts.
No stop loss mechanism to control losses.
Bad parameter tuning can lead to over-trading.
Trend-reliant, underperforms in trending markets.
Performance relies on parameter optimization.
Solutions:
Add other filters to confirm signals.
Implement stop loss to manage risks.
Optimize parameters and limit trade frequency.
Use mainly during range-bound markets.
Continual backtesting and optimization.
Some ways to improve the strategy:
Add volume filter to avoid false breakouts.
Implement stop loss mechanisms like trailing stop loss.
Optimize parameters based on market conditions like trends.
Add other indicators to confirm signals, like MACD, KDJ etc.
Add trend determination to avoid counter-trend trading.
Optimize lookback period to balance frequency and quality.
This strategy uses doji patterns with SMA for efficient reversal trading. It has advantages like simple rules and easy trading. But also has risks and areas for improvement. With continual optimization it can become a solid short-term trading system.
[/trans]
/*backtest
start: 2022-09-20 00:00:00
end: 2023-09-26 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Doji Reversal", overlay=true)
smaPeriod = input(title="SMA Period", defval=10, minval=0)
tolerance = input(title="Tolerance", defval=0.1, minval=0)
lookbackEnd = input(title="End", defval=2, minval=0)
avg = sma(close, smaPeriod)
signal_long = bool(false)
signal_short = bool(false)
for i = 1 to lookbackEnd
is_doji = (abs(close[i] - open[i]) / (high[i] - low[i])) < tolerance
signal_long := signal_long or ( is_doji and (close[i-1] <= high[i] or i == 1) and close[i-1] > high[i] and high[i] < avg and close > open )
signal_short := signal_short or ( is_doji and (close[i-1] >= low[i] or i == 1) and close[i-1] < low[i] and low[i] > avg and close < open )
plotshape(signal_long, "LONG", style=shape.triangleup, size=size.normal)
plotshape(signal_short, "SHORT", style=shape.triangledown, size=size.normal)
strategy.entry("LONG", strategy.long, when=signal_long)
strategy.entry("SHORT", strategy.short, when=signal_short)