यह रणनीति बिटकॉइन और एथेरियम जैसी क्रिप्टोकरेंसी के लिए एक सरल स्वचालित बहु-हेड प्रवृत्ति रणनीति है, जो तकनीकी संकेतकों पर आधारित है, जिसका उद्देश्य मुख्य अपट्रेंड को पकड़ना और बार-बार लेनदेन के कारण होने वाले कमीशन को कम करना है।
MACD का उपयोग प्रवृत्ति की दिशा का निर्धारण करने के लिए किया जाता है, जो कि ऊपर की ओर होने पर अधिक दिखता है;
20 चक्र ईएमए, 100 चक्र एसएमए और 200 चक्र एसएमए की गणना करें, ईएमए और एसएमए ऊपर की ओर बढ़ते हैं;
ईएमए एसएमए से ऊपर है और एसएमए एसएमए से ऊपर है।
स्टॉप-लॉस लाइन सेट करें और स्टॉप-लॉस लाइन से नीचे जाने पर स्टॉप-लॉस से बाहर निकलें।
जब कीमतें गिरती हैं तो ईएमए के नीचे एसएमए को पार करते हुए ब्रीफिंग से बाहर निकलें
इस रणनीति में रुझानों और प्रवेश के समय को निर्धारित करने के लिए कई संकेतकों का संयोजन किया गया है, जिससे प्रमुख अपट्रेंड को ट्रैक करके लाभ प्राप्त किया जा सकता है।
एक बहु-सूचक संयोजन के आधार पर, गलत संकेतों को फ़िल्टर करने के लिए, जैसे कि झूठी घुसपैठ;
ट्रेडों की संख्या को कम करने के लिए, ट्रेडों को केवल ट्रेंड के स्पष्ट होने पर ही शुरू करें।
स्टॉप लॉस रणनीति एक एकल लेनदेन के अधिकतम नुकसान को प्रभावी ढंग से नियंत्रित करती है।
रिटेल डेटा से पता चलता है कि बिटकॉइन और एथेरियम में बेहतर रिटर्न प्राप्त किया जा सकता है;
रणनीति तर्क सरल और स्पष्ट है, इसे लागू करना आसान है और शुरुआती लोगों के लिए उपयुक्त है।
यह स्केलेबल है और इसे अनुकूलित करने के लिए और अधिक मापदंडों को शामिल किया जा सकता है।
बाजारों में अस्थिरता के कारण गलत निर्णय लेने का खतरा है।
सिंगल होल्डिंग सिस्टम जोखिम से बचने में असमर्थ है;
गलत स्टॉप पॉइंट सेटिंग से अत्यधिक स्टॉप हो सकता है;
रिट्रेसमेंट डेटा वास्तविक प्रदर्शन का प्रतिनिधित्व नहीं करता है, वास्तविक प्रभाव को सत्यापित किया जाना है;
लेन-देन शुल्क के प्रभाव को ध्यान में रखे बिना, वास्तविक परिणाम भिन्न हो सकते हैं।
विभिन्न किस्मों की विशेषताओं को ध्यान में रखे बिना, अनुकूलन को समायोजित करने की आवश्यकता है।
विभिन्न मापदंडों के संयोजनों का परीक्षण करना और मापदंडों को अनुकूलित करना;
KDJ जैसे सूचकांकों के प्रवेश संकेतों को फ़िल्टर करने के लिए;
स्टॉप लॉस रणनीति को अनुकूलित करें, गतिशील स्टॉप लॉस को शामिल करें;
खाता धन प्रबंधन पर विचार करें, स्थिति आकार को समायोजित करें;
नस्ल की विशेषताओं को अलग करना, पैरामीटर को समायोजित करना;
और अधिक समय-चक्र सूचकांकों के साथ;
विभिन्न किस्मों का परीक्षण करें और सर्वश्रेष्ठ किस्मों का पता लगाएं।
इस रणनीति की समग्र सोच स्पष्ट और समझने में आसान है, बहु-सूचक निर्णय का उपयोग करके त्रुटि संकेतों को प्रभावी ढंग से फ़िल्टर किया जा सकता है। लेकिन पैरामीटर, जोखिम नियंत्रण आदि को और अनुकूलित करने की आवश्यकता है, फिर इसे वास्तविक क्षेत्र सत्यापन के साथ जोड़ा जा सकता है। यदि अनुकूलन को आगे बढ़ाया जाता है, तो यह एक बहुत ही व्यावहारिक क्रिप्टोक्यूरेंसी प्रवृत्ति ट्रैकिंग रणनीति बन सकती है।
/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(title="BTC Long strategy", overlay=true, max_bars_back=3000, initial_capital=1000, commission_value=0.075)
//////////// !!!!!!!!!!!!!!!! WORK BEST IN 2 HOURS for BTC, ETH and ETHXBT !!!!!!!!!!!!!!!!!!! /////////////////////
[macdLine, macdSignalLine, macdHist] = macd(close, 12, 26, 7)
//_rsi_len = input(14, title="RSI length")
_rsi_len = 14
NewValue = 0
PreviousValue = 0
leverage = 1
smaPercentageIncrease = 0.0
SMA_PERCENT_INCREASE = 0.0
float atrValue = 0
bool bPositionOpened = false
float stockPositionSize = 0
float volatilityPercentage = 0.0
bool bDisplayArrow = false
bool bEMAIsRising = false
bool bSMAIsRising = false
bool bSMASlowIsRising = false
bool bMACDIsRising = false
bool bMACDHistIsRising = false
bool bMACDSignalIsRising = false
float stopLoss = input (1.5, "StopLoss in %", type=input.float) //StopLoss associated with the order
//positionSize = input (1000, "in $")
float positionSize = 1000
float currentPrice = close
float stopLossPrice = 0
float entryPrice = 0
//-----------------------------------------------------------
// === INPUT BACKTEST RANGE ONE YEAR
//FromDay = input(defval = 01, title = "From Day", minval = 1, maxval = 31)
//FromMonth = input(defval = 01, title = "From Month", minval = 1, maxval = 12)
//FromYear = input(defval = 2020, title = "From Year", minval = 2017)
FromDay = 01
FromMonth = 01
FromYear = 2019
//ToDay = input(defval = 01, title = "To Day", minval = 1, maxval = 31)
//ToMonth = input(defval = 01, title = "To Month", minval = 1, maxval = 12)
//ToYear = input(defval = 2023, title = "To Year", minval = 2017)
ToDay = 31
ToMonth = 12
ToYear = 2099
// === FUNCTION EXAMPLE ===
start = timestamp(FromYear, FromMonth, FromDay, 00, 00) // backtest start window
finish = timestamp(ToYear, ToMonth, ToDay, 23, 59) // backtest finish window
window() => true // create function "within window of time"
//emaLength = input(20, "EMA Length")
//smaLength = input(100, "SMA Length")
//smaSlowLength = input(200, "SMA Length")
emaLength = 20
smaLength = 100
smaSlowLength = 200
ema = ema(close, emaLength)
sma = sma(close, smaLength)
smaSlow = sma(close, smaSlowLength)
plot(sma, color=color.green)
plot(smaSlow, color=color.orange)
plot(ema, color=color.yellow)
//reload previous values
stopLossPrice := na(stopLossPrice[1]) ? 0.0 : stopLossPrice[1]
entryPrice := na(entryPrice[1]) ? 0.0 : entryPrice[1]
bPositionOpened := na(bPositionOpened[1]) ? false : bPositionOpened[1]
positionSize := na(positionSize[1]) ? 50000 : positionSize[1]
stockPositionSize := na(stockPositionSize[1]) ? 0 : stockPositionSize[1]
//leverage := na(leverage[1]) ? 1 : leverage[1]
//ReEvaluate the direction of indicators
bEMAIsRising := rising(ema, 2)
bSMAIsRising := rising(sma, 3)
bMACDIsRising := rising(macdLine, 3)
bMACDHistIsRising := rising(macdHist, 1)
bSMASlowIsRising := rising(smaSlow, 10)
bMACDSignalIsRising := rising(macdSignalLine, 3)
atrValue := atr(14)
volatilityPercentage := (atrValue/currentPrice)*100 //calcute the volatility. Percentage of the actual price
//There is too many signal in tranding market, to avoid this we need to make sure that the smaSlow has a mininal increase
//THIS DOES NOT WORK AT ALL!!!!!
//if bSMASlowIsRising == true
// //calculate the percentegage difference over the last 10 bars
// smaPercentageIncrease := ((smaSlow[0]/sma[10])-1)*100
// if smaPercentageIncrease < SMA_PERCENT_INCREASE
// //Not enough increase we reset the flag
// bSMASlowIsRising := false
if (window())
//Check if we can open a LONG
//sma > smaSlow and
if ( volatilityPercentage < 2 and bPositionOpened == false and bSMASlowIsRising == true and bMACDIsRising == true and bEMAIsRising == true and bSMAIsRising == true and ema[0] > sma[0] and sma[0] < currentPrice)
// add comparaison between macd and macd signal line
//if (bPositionOpened == false and macdSignalLine < macdLine and bMACDIsRising == true and bMACDHistIsRising == true and bEMAIsRising == true and bSMAIsRising == true and ema[1] > sma[1] and sma[1] < currentPrice)
//Enter in short position
stockPositionSize := (positionSize*leverage)/currentPrice //Calculate the position size based on the actual price and the position Size (in $) configured.
//calculate exit values
stopLossPrice := currentPrice*(1-stopLoss/100)
strategy.entry("myPosition", strategy.long, qty=stockPositionSize, comment="BUY at " + tostring(currentPrice))
entryPrice := currentPrice //store the entry price
bPositionOpened := true
bDisplayArrow := true
//if (bPositionOpened == true and (currentPrice <= stopLossPrice or crossunder(ema[1], sma[1]) or currentPrice < sma[1]))
if (bPositionOpened == true and (currentPrice <= stopLossPrice or crossunder(ema[1], sma[1])))
strategy.close("myPosition", comment="" + tostring(currentPrice) ) //Stop
//uncomment the below line to make the bot investing the full portfolio amount to test compounding effect.
//positionSize := positionSize + ((stockPositionSize * currentPrice) - (positionSize*leverage))
//reset some flags
bPositionOpened := false
bDisplayArrow := true
entryPrice := 0.0