
이 전략은 여러 가지 기술 지표를 고려하여 시장에 강한 다중 동력이 있다고 판단 할 때 구매 작업을 수행합니다. 구체적으로, 전략은 MACD, RSI, ADX, Stochastic 및 Brin을 포함한 5 개의 지표를 동시에 고려하여 다중 조건이 동시에 충족되면 구매 신호를 생성합니다.
이 전략의 핵심 논리는 시장에 강한 다중 동력이 있다고 판단한 후에 구매하는 것이다. 구체적인 판단 규칙은 다음과 같다:
위의 5가지 조건이 동시에 성립할 때, 시장의 다면적 동력이 강하다고 여겨지며, 이 때 구매운동을 한다.
거래 탈퇴 규칙은 5분 종료 가격 아래 5분 EMA를 깨면 현재 포지션을 탈퇴한다.
이 전략에는 다음과 같은 장점이 있습니다.
전체적으로 보면, 이 전략은 정확한 판단과 적절한 위험 관리를 통해 단선과 다중의 상황을 포착할 수 있습니다.
이 전략에는 몇 가지 위험도 있습니다.
전반적으로, 이 전략의 위험은 주로 출전 오류와 조기 퇴출에 관한 것으로, 이는 변수 최적화와 규칙 조정으로 완화될 필요가 있다.
이 전략은 다음과 같은 방향으로 최적화될 수 있습니다.
매개 변수와 규칙의 최적화를 통해 이 전략의 수익률과 위험 제어 능력을 더욱 향상시킬 수 있다.
이 전략은 여러 지표들을 고려하여 시장의 다방면 경향을 판단하고, 출구 메커니즘은 엄격하다. 전략 판단은 정확하고, 단선 상황을 포착할 수 있고, 위험 통제도 좋다. 지속적으로 최적화되는 매개 변수와 거래 규칙을 통해 전략의 효과를 더욱 강화할 수 있다.
/*backtest
start: 2022-11-15 00:00:00
end: 2023-11-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © makarandpatil
// This strategy is for Bank Nifty instrument and for intraday purpose only
// It checks for various indicators and gives a buy signal when all conditions are met
// Bank Nifty when in momentum gives 100-200 points in spot in 5-15 min which is how long the trade duration should be
// Issues - The custom script as per TradingView Pinescripting has an issue of repaint
// More information on repainting issue in this link - https://www.tradingview.com/pine-script-docs/en/v5/concepts/Repainting.html
// Use the script alert only to get notified, however check all the parameters individually before taking the trade
// Also, please perform a backtesting and deep backtesting of this strategy to see if the strategy gave correct buy signals in the past
// The script is made for testing purposes only and is in beta mode. Please use at own risk.
//@version=5
strategy("BankNifty_Bullish_Intraday", overlay=true, margin_long = 100, margin_short = 100)
// Variables
StochLength = input(14, title="Stochastic Length")
smoothK = input(3, title="%K Smoothing")
smoothD = input(3, title="%D Smoothing")
//INDICATOR CALCULATIONS
// 1. MACD
[macdLine, signalLine, histLine] = ta.macd(close[0],12,26,9)
macd5 = request.security(syminfo.tickerid, "5", macdLine)
macd15 = request.security(syminfo.tickerid,"15",macdLine)
macd60 = request.security(syminfo.tickerid,"60",macdLine)
// 2. RSI Calculation
xRSI = ta.rsi(close, 14)
// 3. ADX calculation
[diplus, diminus, adx] = ta.dmi(14,14)
// plot(adx,color = color.black)
// 4. Stochastic Calculation
k = ta.sma(ta.stoch(close, high, low, StochLength), smoothK)
d = ta.sma(k, smoothD)
// 5. Bollinger Band calculation
[middle, upper, lower] = ta.bb(close, 20, 2)
//CONDITIONS
// 1. Conditions for MACD
macd5Uptick = macd5[0] > macd5[1]
macd15Uptick = macd15[0] > macd15[1]
macd60Uptick = macd60[0] >= macd60[1]
// 2. Condition for xRSI
RSIStrong = xRSI > 60
// 3. Condition for ADX
ADXUngali = adx >= 12
// 4. Condition for Stochastic
StochPCO = k > d
// 5. Condition for Bollinger Band
BBCU = upper > upper [1]
//Evaluate the long condition
// longCondition = macd5Uptick and macd15Uptick and RSIStrong and ADXUngali and StochPCO and BBCU
longCondition = macd5Uptick and macd15Uptick and macd60Uptick and RSIStrong and ADXUngali and StochPCO and BBCU
// longCondition = macd5Uptick and macd15Uptick and RSIStrong and ADXUngali and StochPCO and BBCU
if (longCondition)
strategy.entry("Buy", strategy.long,alert_message = "BankNifty_Buy_Momentum")
shortCondition = close < ta.ema(close,5)
if (shortCondition)
strategy.entry("BuySquareoff", strategy.short, alert_message = "BankNifty_Closed_Below_5EMA")