इंट्राडे रणनीति के बाद एमएसीडी रुझान

लेखक:चाओझांग, दिनांक: 2023-12-19 11:16:44
टैगः

img

अवलोकन

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

रणनीति तर्क

इस रणनीति का मुख्य व्यापारिक तर्क कई पहलुओं पर आधारित हैः

  1. जब कीमत एक्सपोनेंशियल मूविंग एवरेज (ईएमए) लाइन से ऊपर टूटती है, तो लॉन्ग जाएं और जब यह नीचे टूटती है, तो शॉर्ट जाएं;

  2. जब एमएसीडी फास्ट लाइन स्लो लाइन से ऊपर हो, तब लॉन्ग और जब नीचे हो, तब शॉर्ट करें।

  3. जब विलियम इंडिकेटर की तेज एमए लाइन धीमी एमए लाइन से ऊपर हो, और इसके विपरीत;

  4. इन तीन परिदृश्यों के संयोजनों का उपयोग प्रवेश की शर्तों के रूप में करें;

  5. रिवर्स सिग्नल पर बाहर निकलें.

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

लाभ

यह बहु-सूचक संयोजन संरचना एक विशिष्ट अल्पकालिक प्रवृत्ति बनाती है, जिसमें मुख्य किनारे होते हैंः

  1. झूठे संकेतों को कम करने के लिए तीन गुना क्रॉस वेरिफिकेशन;

  2. मुख्य प्रवृत्ति के लिए ईएमए, अल्पकालिक गति के लिए एमएसीडी;

  3. विलियम्स संकेतक अस्थिर चाल के दौरान शीर्ष या नीचे मछली पकड़ने का पीछा करने से बचता है;

  4. रिवर्स कॉम्बो जोखिम नियंत्रण को बाहर निकलने के साथ संरेखित करता है।

जोखिम

इस रणनीति के लिए महत्वपूर्ण जोखिम भी हैं:

  1. जटिल संरचना पैरामीटर ट्यूनिंग को चुनौतीपूर्ण बनाती है;

  2. लगातार अल्पकालिक लेनदेन से लेनदेन की लागत बढ़ सकती है;

  3. वास्तविक रुझान उलट बिंदुओं का पता लगाने में विफलता के परिणामस्वरूप नुकसान हो सकता है।

मुख्य शमन पैरामीटर अनुकूलन और लाभ संयोजन को अधिकतम करने और अधिकतम एकल व्यापार हानि को नियंत्रित करने के लिए स्टॉप लॉस हैं।

बढ़ोतरी के अवसर

रणनीति को बेहतर बनाने के लिए मुख्य पहलूः

  1. इष्टतम सेट के लिए अधिक पैरामीटर संयोजनों का परीक्षण करें;

  2. प्रविष्टि सत्यापन के लिए मात्रा जैसे अधिक डेटा फ़ीड जोड़ें;

  3. जोखिम नियंत्रण को मजबूत करने के लिए गतिशील या ट्रेलिंग स्टॉप लॉस का उपयोग करें;

  4. वास्तविक उलटफेर का पता लगाने के लिए मशीन लर्निंग को शामिल करें।

निष्कर्ष

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


/*backtest
start: 2023-11-18 00:00:00
end: 2023-12-18 00:00:00
period: 1h
basePeriod: 15m
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/
// © platsn

//@version=5
strategy("MACD Willy Strategy", overlay=true, pyramiding=1, initial_capital=10000) 

// ******************** Trade Period **************************************
startY = input(title='Start Year', defval=2011, group = "Trading window")
startM = input.int(title='Start Month', defval=1, minval=1, maxval=12, group = "Trading window")
startD = input.int(title='Start Day', defval=1, minval=1, maxval=31, group = "Trading window")
finishY = input(title='Finish Year', defval=2050, group = "Trading window")
finishM = input.int(title='Finish Month', defval=12, minval=1, maxval=12, group = "Trading window")
finishD = input.int(title='Finish Day', defval=31, minval=1, maxval=31, group = "Trading window")
timestart = timestamp(startY, startM, startD, 00, 00)
timefinish = timestamp(finishY, finishM, finishD, 23, 59)
// t1 = time(timeframe.period, "0945-1545:23456") 
// window = time >= timestart and time <= timefinish and t1 ? true : false 
// t2 = time(timeframe.period, "0930-1555:23456")
// window2 = time >= timestart and time <= timefinish and t2 ? true : false 

leverage = input.float(1, title="Leverage (if applicable)", step=0.1, group = "Trading Options")
reinvest = input.bool(defval=false,title="Reinvest profit", group = "Trading Options")
reinvest_percent = input.float(defval=20, title = "Reinvest percentage", group="Trading Options")
// entry_lookback = input.int(defval=10, title="Lookback period for entry condition", group = "Trading Options")

// -------------------------------------------- Data Source --------------------------------------------

src = input(title="Source", defval=close)

// ***************************************************************************************************** Daily ATR *****************************************************
atrlen = input.int(14, minval=1, title="ATR period", group = "Daily ATR")
iPercent = input.float(5, minval=1, maxval=100, step=0.1, title="% ATR to use for SL / PT", group = "Daily ATR")
 
percentage = iPercent * 0.01
datr = request.security(syminfo.tickerid, "1D", ta.rma(ta.tr, atrlen))
datrp = datr * percentage

// plot(datr,"Daily ATR")
// plot(datrp, "Daily % ATR")

//*********************************************************** VIX volatility index ****************************************

VIX = request.security("BTC_USDT:swap", timeframe.period, close)
vix_thres = input.float(20.0, "VIX Threshold for entry", step=0.5, group="VIX Volatility Index")

// ************************************************ Volume ******************************************************

vol_len = input(50, 'Volume MA Period')
avg_vol = ta.sma(volume, vol_len)

//-------------------------------------------------------- Moving Average ------------------------------------

emalen1 = input.int(200, minval=1, title='EMA', group= "Moving Averages")
ema1 = ta.ema(src, emalen1)

// ------------------------------------------ MACD ------------------------------------------
// Getting inputs
fast_length = input(title="Fast Length", defval=12)
slow_length = input(title="Slow Length", defval=26)
signal_length = input.int(title="Signal Smoothing",  minval = 1, maxval = 50, defval = 9)
sma_source = input.string(title="Oscillator MA Type",  defval="EMA", options=["SMA", "EMA"])
sma_signal = input.string(title="Signal Line MA Type", defval="EMA", options=["SMA", "EMA"])
// Plot colors
col_macd = input(#2962FF, "MACD Line  ", group="Color Settings", inline="MACD")
col_signal = input(#FF6D00, "Signal Line  ", group="Color Settings", inline="Signal")
col_grow_above = input(#26A69A, "Above   Grow", group="Histogram", inline="Above")
col_fall_above = input(#B2DFDB, "Fall", group="Histogram", inline="Above")
col_grow_below = input(#FFCDD2, "Below Grow", group="Histogram", inline="Below")
col_fall_below = input(#FF5252, "Fall", group="Histogram", inline="Below")
// Calculating
fast_ma = sma_source == "SMA" ? ta.sma(src, fast_length) : ta.ema(src, fast_length)
slow_ma = sma_source == "SMA" ? ta.sma(src, slow_length) : ta.ema(src, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal == "SMA" ? ta.sma(macd, signal_length) : ta.ema(macd, signal_length)
hist = macd - signal

// ---------------------------------------- William %R --------------------------------------
w_length = input.int(defval=34, minval=1)
w_upper = ta.highest(w_length)
w_lower = ta.lowest(w_length)

w_output = 100 * (close - w_upper) / (w_upper - w_lower)

fast_period = input(defval=5, title='Smoothed %R Length')
slow_period = input(defval=13, title='Slow EMA Length')

w_fast_ma = ta.wma(w_output,fast_period)
w_slow_ma = ta.ema(w_output,slow_period)



// ------------------------------------------------ Entry Conditions ----------------------------------------

L_entry1 = close > ema1 and hist > 0 and w_fast_ma > w_slow_ma 
S_entry1 = close < ema1 and hist < 0 and w_fast_ma < w_slow_ma 

// -------------------------------------------------- Entry -----------------------------------------------
strategy.initial_capital = 50000
profit = strategy.netprofit
trade_amount = math.floor(strategy.initial_capital*leverage / close) 

if strategy.netprofit > 0 and reinvest
    trade_amount := math.floor((strategy.initial_capital+(profit*reinvest_percent*0.01))*leverage / close) 
else
    trade_amount := math.floor(strategy.initial_capital*leverage/ close) 


if L_entry1 //and window
    strategy.entry("Long", strategy.long, trade_amount)

if S_entry1 //and window
    strategy.entry("Short", strategy.short, trade_amount)

// --------------------------------------------------- Exit Conditions -------------------------------------

L_exit1 = hist < 0 and w_fast_ma < w_slow_ma and w_fast_ma < -20
S_exit1 = hist > 0 and w_fast_ma > w_slow_ma and w_fast_ma > -80

// ----------------------------------------------------- Exit ---------------------------------------------

if L_exit1 //and window2
    strategy.close("Long")
    
if S_exit1 //and window2
    strategy.close("Short")

// if time(timeframe.period, "1530-1600:23456")
//     strategy.close_all()

अधिक