गति ब्रेकआउट इंट्राडे ट्रेडिंग रणनीति

लेखक:चाओझांग, दिनांकः 2024-02-01 10:32:21
टैगः

img

अवलोकन

यह रणनीति एसपीवाई ट्रेडिंग डेटा को ट्रैक करती है और अल्पकालिक रुझानों को सटीक रूप से निर्धारित करने के लिए चलती औसत, एमएसीडी, आरएसआई जैसे तकनीकी संकेतकों के संयोजन के माध्यम से इंट्राडे ट्रेडिंग लाभ प्राप्त करने के लिए खरीद और बिक्री निर्णय लेती है।

रणनीति तर्क

इस रणनीति का मूल तर्क अल्पकालिक रुझानों और प्रवेश बिंदुओं को निर्धारित करने के लिए निम्नलिखित तकनीकी संकेतकों पर आधारित है:

  1. 5 दिवसीय और 13 दिवसीय घातीय चलती औसत (ईएमए) के स्वर्ण क्रॉस और मृत्यु क्रॉस का उपयोग तेजी और मंदी के रुझानों के मोड़ को निर्धारित करने के लिए किया जाता है।
  2. एमएसीडी सूचक का उपयोग यह निर्धारित करने के लिए किया जाता है कि क्या ऊपर की ओर गति है।
  3. ADX सूचक का उपयोग यह निर्धारित करने के लिए किया जाता है कि क्या कोई प्रवृत्ति है।
  4. आरएसआई सूचक का उपयोग प्रवृत्ति की ताकत निर्धारित करने के लिए किया जाता है।

उपरोक्त संकेतकों के मापदंडों को अनुकूलित करके, तेजी और मंदी के रुझानों के प्रमुख उलट बिंदु निर्धारित किए जा सकते हैं। जब 6 में से 5 शर्तें पूरी हो जाती हैं, तो सफेद एल या एस संकेत प्रदर्शित होते हैं। जब सभी छह शर्तें पूरी तरह से पूरी हो जाती हैं, तो कैंडलस्टिक बार बंद होने पर सोने के △ आकार प्रदर्शित होते हैं।

लंबे समय तक प्रवेश संकेत की स्थितिः
5-दिवसीय ईएमए 13-दिवसीय ईएमए से अधिक और एमएसीडी लाइन 0.5 से कम और एडीएक्स 20 से अधिक और एमएसीडी ढलान 0 से अधिक और सिग्नल लाइन -0.1 से अधिक और आरएसआई 40 से अधिक

संक्षिप्त प्रवेश संकेत की स्थितिः
5-दिवसीय ईएमए 13-दिवसीय ईएमए से कम और एमएसीडी रेखा -0.5 से अधिक और एडीएक्स 20 से अधिक और संकेत रेखा 0 से कम और एमएसीडी ढलान 0 से कम और आरएसआई 60 से कम

लाभ विश्लेषण

इस रणनीति के लाभों में निम्नलिखित शामिल हैंः

  1. कई संकेतकों के संयोजन से अधिक सटीकता।
  2. पैरामीटर अनुकूलन के माध्यम से संतुलित संवेदनशीलता और सटीकता।
  3. सरल और स्पष्ट संकेत, संचालन के लिए कम बाधा।
  4. इंट्राडे ट्रेडिंग के लिए उपयुक्त, अधिकांश निवेशकों के जोखिम की इच्छा से मेल खाता है।
  5. देर से ट्रेडिंग में उच्च अस्थिरता से बचता है आदेश नहीं देकर।

जोखिम विश्लेषण

इस रणनीति के जोखिमों में निम्नलिखित शामिल हैंः

  1. गलत पैरामीटर सेटिंग्स से गलत निर्णय. निरंतर परीक्षण और अनुकूलन की आवश्यकता है.
  2. एकल परिसंपत्ति, उद्योग और परिसंपत्ति आवंटन जोखिमों को विविध करने में असमर्थ।
  3. बार-बार व्यापार करने से लेनदेन शुल्क और फिसलने का जोखिम होता है।
  4. देर से ट्रेडिंग सत्रों में ट्रेडिंग न करके कुछ अवसरों को खोना।

अनुकूलन दिशाएँ

इस रणनीति को निम्नलिखित पहलुओं में और अधिक अनुकूलित किया जा सकता हैः

  1. निर्णय की सटीकता में सुधार के लिए पैरामीटर सेटिंग्स को संशोधित करने का परीक्षण करें।
  2. एकल हानि को नियंत्रित करने के लिए स्टॉप लॉस इंडिकेटर जोड़ें।
  3. उच्च अस्थिरता की अवधि को फ़िल्टर करने के लिए ऑर्डर देने के समय को अनुकूलित करें।
  4. रणनीतिक लक्ष्यों के रूप में अन्य उत्पाद जोड़ें।
  5. पैरामीटर स्व-अनुकूली क्षमता में सुधार के लिए मशीन लर्निंग एल्गोरिदम शामिल करें।

निष्कर्ष

यह रणनीति एसपीवाई डेटा को ट्रैक करके और चलती औसत, एमएसीडी और आरएसआई जैसे कई तकनीकी संकेतकों को मिलाकर अल्पकालिक रुझानों को निर्धारित करती है। उच्च संचालन आवृत्ति, कम ड्रॉडाउन के साथ, यह इंट्राडे ट्रेडिंग के लिए बहुत उपयुक्त है। कई आयामों से अनुकूलन के माध्यम से सुधार के लिए अभी भी बड़ी जगह है।


/*backtest
start: 2024-01-24 00:00:00
end: 2024-01-31 00:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy(title="SPY 1 Minute Day Trader", overlay=true)

//This script has been created to take into account how the following variables impact trend for SPY 1 Minute
//The SPY stop losses/take profit have been set at 30 cents which equates to 15 cents on SPY 1 DTE ATM contracts
//5 ema vs 13 ema : A cross establishes start of trend
//MACD (Line, Signal & Slope) : If you have momentum
//ADX : if you are trending
//RSI : If the trend has strength
//The above has been optimized to determine pivot points in the trend using key values for these 6 indicators
//bounce up = ema5 > ema13 and macdLine < .5 and adx > 20 and macdSlope > 0 and signalLine > -.1 and rsiSignal > 40
//bounce down = ema5 < ema13 and macdLine > -.5 and adx > 20 and signalLine < 0 and macdSlope < 0 and rsiSignal < 60
//White L's indicate that 5 of 6 conditions are met due to impending uptrend w/ missing one in green below it
//Yellow L's indicate that 6 of 6 conditions still are met
//White S's indicate that 5 of 6 conditions are met due to impending downtrend w/ missing condition in red above it
//Yellow S's indicate that 6 of 6 conditions still are met
//After a downtrend or uptrend is established, once it closes it can't repeat for 10 minutes
//Won't open any trades on last two minutes of any hours to avoid volatility
//Will close any open trades going into last minute of hour

// Initialize variables
var float long_entry_price = na
var float short_entry_price = na
var float stop_loss = na
var float take_profit = na
var float short_stop_loss = na
var float short_take_profit = na
var float option_SL = 0.3 //approx 15 cents on SPY 1 DTE
var float option_TP = 0.3 //approx 15 cents on SPY 1 DTE
var long_entry_time = 0
var short_entry_time = 0
var allow_long_entry = true
var allow_short_entry = true
var allow_trades = true
var hourlyclose = 0
var notify = 0
var shortnotify = 0

// Calculate the EMAs & SMAs
ema5 = ta.ema(close, 5)
ema13 = ta.ema(close, 13)
sma20 = ta.sma(close, 20)

// Input parameters
fastLength = input.int(12, minval=1, title="Fast Length")
slowLength = input.int(26, minval=1, title="Slow Length")
signalLength = input.int(9, minval=1, title="Signal Smoothing")

// Inputs
length = input.int(14, "Length")
smoothK = input.int(3, "SmoothK")
src = input(close, "Source")
overbought = input.float(80, "Overbought")
oversold = input.float(20, "Oversold")

//Stochastic Calculation
highestHigh = ta.highest(src, length)
lowestLow = ta.lowest(src, length)
k = 100 * ((src - lowestLow) / (highestHigh - lowestLow))
d = ta.sma(k, smoothK)

// Calculate MACD
[macdLines, signalLines, _] = ta.macd(close, fastLength, slowLength, signalLength)

// Calculate slope of MACD line
macdSlope = (macdLines - macdLines[1]) / (bar_index - bar_index[1])

// Calculate the RSI
rsiValue = ta.rsi(close, 5)

// Calculate the signal line as the SMA of the RSI for 5 minute over 9 periods
rsiSignal = ta.sma(rsiValue, 9)

// Calculate MACD
[macdLine, signalLine, _] = ta.macd(close, 12, 26, 9)

// Length of the ATR
atr_length = input.int(14, title="ATR Length", minval=1)

// Calculate the True Range
tr = ta.tr(true)

// Calculate the ATR
atr = ta.atr(atr_length)

// Length of the ADX
len = input.int(14, minval=1)

// Set minimum number of bars between trades
min_bars_between_trades = 10

// Calculate the Directional Movement
up = ta.change(high)
down = -ta.change(low)
plusDM = na(up) ? na : (up > down and up > 0 ? up : 0)
minusDM = na(down) ? na : (down > up and down > 0 ? down : 0)

// Calculate the Smoothed Directional Movement
plusDI = 100 * ta.ema(plusDM, len) / ta.ema(tr, len)
minusDI = 100 * ta.ema(minusDM, len) / ta.ema(tr, len)

// Calculate the Directional Index (DX)
DX = 100 * math.abs(plusDI - minusDI) / (plusDI + minusDI)

// Calculate the ADX
adx = ta.ema(DX, len)

// Get high, low, and close prices
highPrice = high
lowPrice = low
closePrice = close

// Determine buy and sell signals - Tried to optimize as much as possible - changing these do impact results
buy_signal = ema5 > ema13 and macdLine < .5 and adx > 20 and macdSlope > 0 and signalLine > -.1 and rsiSignal > 40
short_buy_signal = ema5 < ema13 and macdLine > -.5 and adx > 20 and signalLine < 0 and macdSlope < 0 and rsiSignal < 60

// Define long entry conditions
C1 = ema5 > ema13 ? 1 : 0 //E below bar when only one missing
C2 = d < 70 ? 1 : 0 //no longer part of signal - but was Smoothed Stoicastic
C3 = macdLine < .5 ? 1 : 0 //M below bar when only one missing
C4 = adx > 20 ? 1 : 0 //A below bar when only one missing
C5 = macdSlope > 0 ? 1 : 0 //% below bar when only one missing
C6 = signalLine > -.01 ? 1 : 0 //S (MACD Signal) below bar when only one missing
C7 = rsiSignal > 50 ? 1 : 0 //R below bar when only one missing

// Define short entry conditions
C8 = ema5 < ema13 ? 1 : 0 //E above bar when only one missing
C9 = d > 40 ? 1 : 0 //no longer part of signal - but was Smoothed Stoicastic
C10 = macdLine > -0.5 ? 1 : 0 //M above bar when only one missing
C11 = adx > 20 ? 1 : 0 //A above bar when only one missing
C12 = macdSlope < 0 ? 1 : 0 //% above bar when only one missing
C13 = signalLine < 0 ? 1 : 0 //S (MACD Signal) above bar when only one missing
C14 = rsiSignal < 50 ? 1 : 0 //R above bar when only one missing

// Long or Short Incoming denoted by white color and gold means all conditions met
plotchar((C1 + C3 + C4 + C5 + C6 + C7) == 5 ? 1 : na, title="Pivot Up White", char="L", location=location.belowbar, color=color.white, size = size.tiny)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) == 5 ? 1 : na, title="Pivot Down White", char="S", location=location.abovebar, color=color.white, size = size.tiny)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) > 5 ? 1 : na, title="Pivot Up Gold", char="L", location=location.belowbar, color=color.yellow, size = size.tiny)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) > 5 ? 1 : na, title="Pivot Down Gold", char="S", location=location.abovebar, color=color.yellow, size = size.tiny)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C1) != 1 ? 1 : na, title="Missing", char = "", text="E", location=location.belowbar, color=color.green, size = size.small)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C3) != 1 ? 1 : na, title="Missing", char = "", text="M", location=location.belowbar, color=color.green, size = size.small)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C4) != 1 ? 1 : na, title="Missing", char = "", text="A", location=location.belowbar, color=color.green, size = size.small)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C5) != 1 ? 1 : na, title="Missing", char = "", text="%", location=location.belowbar, color=color.green, size = size.small)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C6) != 1 ? 1 : na, title="Missing", char = "", text="S", location=location.belowbar, color=color.green, size = size.small)
plotchar((C1 + C3 + C4 + C5 + C6 + C7) >= 5 and (C7) != 1 ? 1 : na, title="Missing", char = "", text="R", location=location.belowbar, color=color.green, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C8) != 1 ? 1 : na, title="Missing", char = "", text="E", location=location.abovebar, color=color.red, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C10) != 1 ? 1 : na, title="Missing", char = "", text="M", location=location.abovebar, color=color.red, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C11) != 1 ? 1 : na, title="Missing", char = "", text="A", location=location.abovebar, color=color.red, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C12) != 1 ? 1 : na, title="Missing", char = "", text="%", location=location.abovebar, color=color.red, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C13) != 1 ? 1 : na, title="Missing", char = "", text="S", location=location.abovebar, color=color.red, size = size.small)
plotchar((C8 + C10 + C11 + C12 + C13 + C14) >= 5 and (C14) != 1 ? 1 : na, title="Missing", char = "", text="R", location=location.abovebar, color=color.red, size = size.small)

// Execute buy and sell orders
if buy_signal and allow_trades and allow_long_entry  //Don't buy on last 2 minutes of hour
    long_entry_price := open
    strategy.entry("Pivot Up", strategy.long)
    stop_loss := long_entry_price - option_SL
    take_profit := long_entry_price + option_TP
    long_entry_time := time
    allow_long_entry := false
    allow_trades := false
    notify := 1
plotshape(notify == 1 ? 1 : na, "Pivot Up", style=shape.triangleup, offset = 1, location=location.belowbar, size=size.normal, textcolor = color.orange, color=color.orange)
if notify == 1
    notify := notify - 1

if short_buy_signal and allow_trades and allow_short_entry  //Don't buy on last 2 minutes of hour
    short_entry_price := open
    strategy.entry("Pivot Down", strategy.short)
    short_stop_loss := short_entry_price + option_SL
    short_take_profit := short_entry_price - option_TP
    short_entry_time := time
    allow_short_entry := false
    allow_trades := false
    shortnotify := 1
plotshape(shortnotify == 1 ? 1 : na, "Pivot Down", style=shape.triangledown, offset = 1, location=location.abovebar, size=size.normal, textcolor = color.orange, color=color.orange)
if shortnotify == 1
    shortnotify := shortnotify - 1

// Take scalp when in a position and 5 or more parameters are met!
if strategy.position_size != 0 and (C1 + C3 + C4 + C5 + C6 + C7) >5
    strategy.exit("Exit Longs", "Pivot Up", stop=stop_loss, limit = take_profit)
else if strategy.position_size != 0 and (C8 + C10 + C11 + C12 + C13 + C14) >5
    strategy.exit("Exit Shorts", "Pivot Down", stop=short_stop_loss, limit = short_take_profit)

// Reset allow_trades after cool-down period of min_bars_between_trades bars set above
if time > long_entry_time + (time - time[1]) * min_bars_between_trades
    allow_long_entry := true
    allow_trades := true

if time > short_entry_time + (time - time[1]) * min_bars_between_trades
    allow_short_entry := true
    allow_trades := true

// Close all positions at the end of the trading day and when volatile hours approach!
if  strategy.position_size != 0
    strategy.close("Pivot Up")
    strategy.close("Pivot Down")
    hourlyclose := 1
plotshape(hourlyclose == 1 ? 1 : na, "Suggested Volatile Hour Close", text="Suggested Volatile Hour Close", offset = 1, style=shape.triangledown, location=location.abovebar, size=size.tiny, textcolor = color.orange, color=color.orange)
if hourlyclose == 1
    hourlyclose := hourlyclose - 1

अधिक