गति के उलट व्यापार रणनीति

लेखक:चाओझांग, दिनांक: 2023-10-07 16:52:05
टैगः

अवलोकन

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

व्यापारिक तर्क

यह रणनीति वर्तमान प्रवृत्ति दिशा निर्धारित करने के लिए तीन संकेतकों के रूप में आरएसआई, स्टॉक और एमएसीडी का उपयोग करती है। विशिष्ट तर्क हैः

  • आरएसआई ((7): 50 से ऊपर का आरएसआई एक अपट्रेंड का संकेत देता है, जबकि 50 से नीचे का एक डाउनट्रेंड
  • स्टॉक ((%K, 14, 3, 3): %K 50 से ऊपर की प्रवृत्ति है, 50 से नीचे की प्रवृत्ति है
  • एमएसीडी ((12, 26, 9): एमएसीडी सिग्नल लाइन के ऊपर अपट्रेंड है, नीचे डाउनट्रेंड है

जब तीनों संकेतक तेजी वाले होते हैं, तो बार का रंग हरे रंग पर सेट होता है। जब सभी मंदी वाले होते हैं, तो बार का रंग लाल पर सेट होता है। यदि संकेतक के बीच विचलन होता है, तो बार का रंग काले रंग पर सेट होता है।

व्यापार के नियम इस प्रकार हैंः

  • जब वर्तमान पट्टी हरी हो और पिछली पट्टी काली या लाल हो, तो लॉन्ग करें. प्रवेश मूल्य पट्टी के उच्चतम से 0.01 ऊपर है.
  • जब वर्तमान पट्टी लाल हो, और पिछली पट्टी काली या हरी हो, तो शॉर्ट करें. प्रवेश मूल्य पट्टी के निचले स्तर से 0.01 नीचे है.
  • यदि लंबी स्थिति के दौरान बार लाल या काला हो जाता है, तो लंबी ट्रेड को बंद कर दें।
  • यदि शॉर्ट पोजीशन के दौरान बार हरा या काला हो जाता है, तो शॉर्ट ट्रेड को बंद कर दें।

यह रणनीति स्टॉप लॉस और टेक प्रॉफिट सेट करने के लिए एटीआर (7) का भी उपयोग करती है। स्टॉप लॉस एटीआर के 1.5 गुना और टेक प्रॉफिट एटीआर के 3 गुना पर सेट किया जाता है।

लाभ विश्लेषण

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

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

  2. एटीआर स्टॉप लॉस और टेक प्रॉफिट सेटिंग्स उचित हैं। एटीआर प्रभावी रूप से बाजार अस्थिरता को ट्रैक कर सकता है। एटीआर के गुणकों का उपयोग करके, स्टॉप और लक्ष्य को बाजार की स्थितियों के आधार पर गतिशील रूप से समायोजित किया जा सकता है।

  3. सरल और स्पष्ट तर्क, समझने में आसान और स्वचालित। एक स्वचालित व्यापार रणनीति के रूप में उपयुक्त।

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

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

  1. व्यक्तिगत संकेतकों में त्रुटियां प्रवेश समय को प्रभावित कर सकती हैं। त्रुटियों को कम करने के लिए मापदंडों को समायोजित करने या अधिक पुष्टिकरण संकेतकों को जोड़ने पर विचार कर सकते हैं।

  2. एटीआर का आकार महत्वपूर्ण रूप से स्टॉप और लक्ष्यों को प्रभावित करता है। गलत एटीआर गणना के परिणामस्वरूप स्टॉप बहुत चौड़े या लक्ष्य बहुत तंग हो सकते हैं। एटीआर की पुष्टि करने के लिए अतिरिक्त संकेतक जोड़ सकते हैं।

  3. रुझान निर्धारण की कमी। रिवर्सल ट्रेडिंग पर ध्यान केंद्रित किया गया, अपर्याप्त रुझान विश्लेषण से बाजारों में उतार-चढ़ाव हो सकता है। रुझान संकेतक जोड़ सकते हैं।

  4. ओवरफिटिंग जोखिम: मापदंडों और नियमों की मजबूती सत्यापित करने के लिए गहन बैकटेस्टिंग की आवश्यकता होती है।

सुधार की दिशाएँ

इस रणनीति के लिए संभावित सुधारः

  1. रिवर्स प्वाइंट निर्धारित करने में सटीकता बढ़ाने के लिए संकेतकों को समायोजित या जोड़ना। उदाहरण के लिए ओवरबॉट/ओवरसोल्ड स्तरों की जांच करने के लिए बोलिंगर बैंड जोड़ना।

  2. अस्थिरता को बेहतर ढंग से ट्रैक करने के लिए एटीआर गणना का अनुकूलन करना। उदाहरण के लिए एटीआर/मूल्य अनुपात का उपयोग करना।

  3. रेंजिंग बाजारों के दौरान विप्सॉव से बचने के लिए रुझान संकेतकों को जोड़ना। उदाहरण के लिए चलती औसत।

  4. धन प्रबंधन को अनुकूलित करना, जैसे कि निकासी के आधार पर स्थिति आकार को समायोजित करना।

  5. समय-सीमाओं में मजबूती का परीक्षण करने के लिए अवधि अनुकूलन।

  6. विश्वसनीयता सत्यापित करने के लिए विभिन्न उत्पादों और समय अवधि पर अधिक बैकटेस्टिंग।

सारांश

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


/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 2h
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/
// © jwitt98
//The PowerX strategy - based on the rules outlined in the book "The PowerX Strategy: How to Trade Stocks and Options in Only 15 Minutes a Day" by Markus Heitkoetter

//@version=5
strategy("PowerX", overlay=true)
strategy.initial_capital = 50000
longEntry = "Enter long"
shortEntry = "Enter short"
longExit = "Exit long"
shortExit = "Exit short"

//*********************************Begin inputs*********************************

//get time range inputs and set time range bool
timeRangeGroup = "Select the trading range"
startDate = input(timestamp("1 Jan 2021 00:00 +0000"), "Start date", "Select the start date for the trading range", "", timeRangeGroup)
endDate = input(timestamp("1 Jan 2050 00:00 +0000"), "End date", "Select the end date for the trading range", "", timeRangeGroup)
isInTimeRange = true

//get long/short inputs
positionsAllowedGroup = "Select the direction(s) of trades to allow"
isLongsAllowed = input.bool(true, "Allow long positions", "Check the box if you want to allow long positions", "", positionsAllowedGroup)
isShortsAllowed = input.bool(true, "Allow short positions", "Check the box if you want to allow short positions", "", positionsAllowedGroup)

//get the stop loss and profit target multiples.  Per the PowerX rules the ratio shoud be 1:2.  1.5 and 3 are defaults
adrMultuplesGroup="Select the multipliers for the stop loss and profit targets"
stopLossMultiple = input.float(1.5, "Stop loss multiple", 0.1, 10, 0.1, "The ADR is multiplied by the stop loss multiple to calculate the stop loss", group=adrMultuplesGroup)
profitTargetMultiple=input.float(3.0, "Profit target multiple", 0.1, 10, 0.1, "The ADR is multiplied by the profit target multiple to calculate the profit target", group=adrMultuplesGroup)

//get the option to use the money management stategy or not.  This is a fixed ratio type management system
moneyManagementGroup="Money management"
isUsingMoneyManagement=input.bool(false, "Use money management", "Check the box if you want to use a fixed ratio type money management system, such as the type described in PowerX", group=moneyManagementGroup)
initial_riskPercent=input.float(2.0, "Percent risk per trade", .1, 100, .1, "The percentage of capital you want to risk when starting out.  This will increase or decrease base on the money management rules.  Only applicable if money managent is used", group=moneyManagementGroup)/100
isRiskDowsideLimited=input.bool(false, "Keep risk at or above the set point", "Check the box if you don't want the risk to fall below the set \"risk per trade\" percentage, for example, when your equity is underwater. Only applicable if money management is used", "", moneyManagementGroup)
initial_riskPerTrade=initial_riskPercent * strategy.initial_capital 
riskFactor = 0.0
currentProfit = 0.0
currentRisk = 0.0

//*********************************End inputs*********************************

//*********************************Begin money management*********************************

if(isUsingMoneyManagement)
    currentProfit := strategy.equity - strategy.initial_capital
    if(currentProfit < 0)
        currentProfit:=math.abs(currentProfit)
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := 1/riskFactor * initial_riskPercent * strategy.initial_capital
        if(isRiskDowsideLimited)
            currentRisk := initial_riskPerTrade
    else
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := riskFactor * initial_riskPercent * strategy.initial_capital
        
plot(strategy.equity, "Strategy equity")
plot(currentRisk, "Current risk")
plot(riskFactor, "Risk Factor")

//*********************************End money management*********************************


//*********************************Begin indicators*********************************
//4 indicators are used in this strategy, RSI(7), Stochastics(14, 3, 3), MACD(12, 26, 9), and ADR(7)

rsiVal = ta.rsi(close, 7)//this checks out
plot(rsiVal, "RSI(7)", color.lime)

stochKVal = ta.sma(ta.sma(ta.stoch(close, high, low, 14),3),3)//this formula checks out
plot(stochKVal, "Stoch %K", color.lime)

[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(histLine, "MACD Hist", color.lime)

adr = ta.sma(high, 7) - ta.sma(low, 7)
plot(adr, "Average daily range", color.orange)


//*********************************End indicators*********************************

//*********************************Define the bar colors*********************************

greenBar = rsiVal > 50 and stochKVal > 50 and histLine > 0
redBar = rsiVal < 50 and stochKVal < 50 and histLine < 0
blackBar = not greenBar and not redBar

color currentBarColor = switch
    greenBar => color.green
    redBar => color.red
    blackBar => color.gray //because black is too hard to see in dark mmode
    => color.yellow
    
barcolor(currentBarColor)

//*********************************End defining the bar colors*********************************

//*********************************Define the entry, stop loss and profit target*********************************

longStopLimit = high + .01
longProfitTarget = high + (profitTargetMultiple * adr)
longStopLoss = high - (stopLossMultiple * adr)

shortStopLimit = low - .01
shortProfitTarget = low - (profitTargetMultiple * adr)
shortStopLoss = low + (stopLossMultiple * adr)

qtyToTrade= math.floor(currentRisk / (stopLossMultiple * adr))//only if using money management
if(qtyToTrade * high > strategy.equity)
    qtyToTrade := math.floor(strategy.equity / high)

//*********************************End defining stop loss and profit targets*********************************

//*********************************Execute trades, set rules, stop loss and profit targets*********************************

if (greenBar and not greenBar[1] and isInTimeRange and isLongsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(longEntry, strategy.long, qtyToTrade, limit=longStopLimit, stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, qtyToTrade, stop=longStopLimit)
    else
        strategy.order(longEntry, strategy.long, limit=longStopLimit,stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, stop=longStopLimit)
    strategy.exit("Long limit/stop", from_entry=longEntry, limit=longProfitTarget, stop=longStopLoss)
    

if(blackBar or redBar)
    strategy.cancel(longEntry)
    strategy.close(longEntry, longExit)
    

if (redBar and not redBar[1] and isInTimeRange and isShortsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(shortEntry, strategy.short, qtyToTrade, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, qtyToTrade, stop=shortStopLimit)
    else
        strategy.order(shortEntry, strategy.short, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, stop=shortStopLimit)
    strategy.exit("Short limit/stop", from_entry=shortEntry, limit=shortProfitTarget, stop=shortStopLoss)

if(blackBar or greenBar)
    strategy.cancel(shortEntry)
    strategy.close(shortEntry, shortExit)
    

//*********************************End execute trades, set rules, stop loss and profit targets*********************************






















अधिक