
Эта стратегия учитывает несколько технических индикаторов, чтобы совершить покупку, когда рынок имеет сильную многоголовую динамику. В частности, стратегия учитывает одновременно пять индикаторов MACD, RSI, ADX, Stochastic и Brin, чтобы генерировать сигнал покупки, когда эти индикаторы одновременно соответствуют многоголовым условиям.
Основная логика этой стратегии заключается в том, чтобы покупать после того, как выясняется, что рынок имеет сильную многостороннюю динамику.
Когда вышеперечисленные 5 условий одновременно сформированы, считается, что рынок имеет сильную многостороннюю динамику, в этот момент совершаются покупные операции.
Выход из текущей позиции при 5-минутной EMA ниже 5-минутного закрытия.
Эта стратегия имеет следующие преимущества:
В целом, эта стратегия была точна, а риск хорошо контролировался, что позволило поймать короткую линию в многосторонних ситуациях.
Однако эта стратегия также несет в себе некоторые риски:
В целом, риски этой стратегии в основном связаны с ошибками при входе в игру и преждевременным выходом из игры, что необходимо уменьшить путем оптимизации параметров и корректировки правил.
Эта стратегия может быть оптимизирована в следующих направлениях:
Посредством оптимизации параметров и правил, можно еще больше повысить уровень доходности и способность управлять рисками этой стратегии.
В этой стратегии учитываются различные показатели для определения многосторонних тенденций рынка, а механизм выхода более строг. Стратегия является точным, может улавливать короткие линии, а также лучше контролировать риск. Благодаря постоянной оптимизации параметров и правил торговли, эффективность стратегии может быть дополнительно усилена.
/*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")