
यह रणनीति कई प्रकार के रुझान संकेतकों की गणना करके खरीदारी और बिक्री का संचालन करती है जब वे उलट जाते हैं। मुख्य रुझान संकेतकों में टीडीआई, टीसीएफ, टीटीएफ और टीआईआई शामिल हैं। रणनीति विन्यास में चुनती है कि ट्रेडिंग सिग्नल उत्पन्न करने के लिए किस संकेतक का उपयोग करना है।
TDI सूचक मूल्य परिवर्तन की गति के आधार पर गणना करता है। summing और smoothing तकनीक के माध्यम से बनाया गया है। जब TDI दिशा सूचक TDI वक्र को पार करता है, तो अधिक करें और जब यह नीचे जाता है तो इसे साफ करें।
टीसीएफ सूचकांक मूल्य में सकारात्मक परिवर्तन और नकारात्मक परिवर्तन की गणना करता है, ताकि पॉलीहेड और खाली हेड की ताकत का आकलन किया जा सके। जब सकारात्मक परिवर्तन बल नकारात्मक परिवर्तन बल से अधिक हो, तो अधिक करें, अन्यथा स्टॉक को खाली करें।
टीटीएफ सूचक उच्च और निम्न बिंदुओं की तुलना करके प्रवृत्ति का न्याय करता है। अधिक संकेत देने के लिए टीटीएफ सूचक 100 से अधिक है, और इसके विपरीत, यह स्पष्ट है।
टीआईआई सूचकांक औसत रेखा और मूल्य सीमा के साथ एक साथ प्रवृत्ति को बदलने का फैसला करता है। यह अल्पकालिक और दीर्घकालिक दोनों प्रवृत्तियों को ध्यान में रखता है। अधिक संकेतों के लिए, टीआईआई सूचकांक 80 के पार है, और 80 के पार है।
लॉजिक में प्रवेश करें और कई शांतिपूर्ण पदों पर जाएं विन्यस्त संकेतकों के आधार पर उपयुक्त ट्रेडिंग सिग्नल चुनें।
इस रणनीति में कई सामान्य प्रवृत्ति व्यापारिक संकेतकों को शामिल किया गया है, जो बाजार की परिस्थितियों के लिए लचीलापन प्रदान करता है। इसके विशिष्ट फायदे हैंः
इस रणनीति में मुख्य रूप से निम्नलिखित जोखिम हैं:
जोखिम को कम करने के लिए निम्न उपाय किए जा सकते हैंः
इस रणनीति को निम्नलिखित पहलुओं से अनुकूलित किया जा सकता हैः
यह रणनीति कई प्रकार के रुझान उलटा संकेतकों के लाभों को जोड़ती है, जो कि विभिन्न बाजार स्थितियों के लिए अनुकूल है, जो कि रुझान उलटा बिंदुओं पर संचालन के लिए संकेतकों और मापदंडों को कॉन्फ़िगर करके अनुकूलित किया जाता है। कुंजी यह है कि जोखिम को नियंत्रित करते हुए सबसे अच्छा पैरामीटर और संकेतक संयोजन ढूंढें। निरंतर अनुकूलन और सत्यापन के माध्यम से, एक स्थिर अल्फा युक्त रणनीति का निर्माण किया जा सकता है।
/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-15 03:00:00
period: 5m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
//
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © kruskakli
//
// Here is a collection of Trend Indicators as defined by M.H Pee and presented
// in various articles of the "STOCKS & COMMODITIES Magazine"
//
// The actual implementation of the indicators here are made by: everget
//
// I have gather them here so that they easily can be tested.
//
// My own test was made using 15 companies from the OMXS30 list
// during the time period of 2016-2018, and I only went LONG.
//
// The result was as follows:
//
// Average Std.Dev
// profit
// TDI 3.04% 5.97
// TTF 1.22%. 5.73
// TII 1.07% 6.2
// TCF 0.32% 2.68
//
strategy("M.H Pee indicators", overlay=true)
use = input(defval="TDI", title="Use Indicator", type=input.string,
options=["TDI","TCF","TTF","TII"])
src = close
//
// TDI
//
length = input(title="Length", type=input.integer, defval=20)
mom = change(close, length)
tdi = abs(sum(mom, length)) - sum(abs(mom), length * 2) + sum(abs(mom), length)
// Direction Indicator
tdiDirection = sum(mom, length)
tdiLong = crossover(tdiDirection, tdi)
tdiXLong = crossunder(tdiDirection, tdi)
//
// TCF
//
tcflength = input(title="Length", type=input.integer, defval=35)
plusChange(src) =>
change_1 = change(src)
change(src) > 0 ? change_1 : 0.0
minusChange(src) =>
change_1 = change(src)
change(src) > 0 ? 0.0 : -change_1
plusCF = 0.0
plusChange__1 = plusChange(src)
plusCF := plusChange(src) == 0 ? 0.0 : plusChange__1 + nz(plusCF[1])
minusCF = 0.0
minusChange__1 = minusChange(src)
minusCF := minusChange(src) == 0 ? 0.0 : minusChange__1 + nz(minusCF[1])
plusTCF = sum(plusChange(src) - minusCF, tcflength)
minusTCF = sum(minusChange(src) - plusCF, tcflength)
tcfLong = plusTCF > 0
tcfXLong = plusTCF < 0
//
// TTF
//
ttflength = input(title="Lookback Length", type=input.integer, defval=15)
hh = highest(length)
ll = lowest(length)
buyPower = hh - nz(ll[length])
sellPower = nz(hh[length]) - ll
ttf = 200 * (buyPower - sellPower) / (buyPower + sellPower)
ttfLong = crossover(ttf, 100)
ttfXLong = crossunder(ttf, -100)
//
// TII
//
majorLength = input(title="Major Length", type=input.integer, defval=60)
minorLength = input(title="Minor Length", type=input.integer, defval=30)
upperLevel = input(title="Upper Level", type=input.integer, defval=80)
lowerLevel = input(title="Lower Level", type=input.integer, defval=20)
sma = sma(src, majorLength)
positiveSum = 0.0
negativeSum = 0.0
for i = 0 to minorLength - 1 by 1
price = nz(src[i])
avg = nz(sma[i])
positiveSum := positiveSum + (price > avg ? price - avg : 0)
negativeSum := negativeSum + (price > avg ? 0 : avg - price)
negativeSum
tii = 100 * positiveSum / (positiveSum + negativeSum)
tiiLong = crossover(tii, 80)
tiiXLong = crossunder(tii,80)
//
// LOGIC
//
enterLong = (use == "TDI" and tdiLong) or (use == "TCF" and tcfLong) or (use == "TTF" and ttfLong) or (use == "TII" and tiiLong)
exitLong = (use == "TDI" and tdiXLong) or (use == "TCF" and tcfXLong) or (use == "TTF" and ttfXLong) or (use == "TII" and tiiXLong)
// Time range for Back Testing
btStartYear = input(title="Back Testing Start Year", type=input.integer, defval=2016)
btStartMonth = input(title="Back Testing Start Month", type=input.integer, defval=1)
btStartDay = input(title="Back Testing Start Day", type=input.integer, defval=1)
startTime = timestamp(btStartYear, btStartMonth, btStartDay, 0, 0)
btStopYear = input(title="Back Testing Stop Year", type=input.integer, defval=2028)
btStopMonth = input(title="Back Testing Stop Month", type=input.integer, defval=12)
btStopDay = input(title="Back Testing Stop Day", type=input.integer, defval=31)
stopTime = timestamp(btStopYear, btStopMonth, btStopDay, 0, 0)
window() => time >= startTime and time <= stopTime ? true : false
riskPerc = input(title="Max Position %", type=input.float, defval=20, step=0.5)
maxLossPerc = input(title="Max Loss Risk %", type=input.float, defval=5, step=0.25)
// Average True Range (ATR) measures market volatility.
// We use it for calculating position sizes.
atrLen = input(title="ATR Length", type=input.integer, defval=14)
stopOffset = input(title="Stop Offset", type=input.float, defval=1.5, step=0.25)
limitOffset = input(title="Limit Offset", type=input.float, defval=1.0, step=0.25)
atrValue = atr(atrLen)
// Calculate position size
maxPos = floor((strategy.equity * (riskPerc/100)) / src)
// The position sizing algorithm is based on two parts:
// a certain percentage of the strategy's equity and
// the ATR in currency value.
riskEquity = (riskPerc / 100) * strategy.equity
// Translate the ATR into the instrument's currency value.
atrCurrency = (atrValue * syminfo.pointvalue)
posSize0 = min(floor(riskEquity / atrCurrency), maxPos)
posSize = posSize0 < 1 ? 1 : posSize0
if (window())
strategy.entry("Long", long=true, qty=posSize0, when=enterLong)
strategy.close_all(when=exitLong)