ट्रेंड ब्लॉक रणनीति


निर्माण तिथि: 2023-11-06 09:20:34 अंत में संशोधित करें: 2023-11-06 09:20:34
कॉपी: 0 क्लिक्स: 376
1
ध्यान केंद्रित करना
1166
समर्थक

ट्रेंड ब्लॉक रणनीति

अवलोकन

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

सिद्धांत

इस रणनीति की गणना मूल्य परिवर्तन के प्रतिशत या पल्स पॉइंट्स विचलन पर आधारित होती है, और इसे समकोण रेखाओं के रूप में चार्ट पर प्रदर्शित किया जाता है।

प्रत्येक पंक्ति में मध्य रेखा, ऊपरी सीमा रेखा और निचली सीमा रेखा होती हैः

  • यदि कीमतें एक समय अंतराल के भीतर तेजी से बदलती हैं, तो वर्तमान पंक्ति की मध्य रेखा पिछली पंक्ति की ऊपरी सीमा से अधिक या अगली पंक्ति की निचली सीमा से कम होगी, जो मूल्य परिवर्तन की दिशा के आधार पर एक समान विचलन की संख्या है। गणना शुरू करने पर, मध्य रेखा पहली पंक्ति के प्रारंभिक मूल्य के बराबर है।

  • स्ट्रेच की संख्या स्ट्रेच पैरामीटर मूल्य परिवर्तन की दिशा को बदलने के लिए स्ट्रेच रिवर्स स्ट्रेच पैरामीटर को निर्धारित करता है, जो मूल्य परिवर्तन की दिशा को बदलने के लिए स्ट्रेच रिवर्स स्ट्रेच को निर्धारित करता है।

नई पंक्तियों के निर्माण के नियम:

  • यदि समापन मूल्य ≥ ऊपरी सीमा है और समापन मूल्य> उद्घाटन मूल्य है, तो ऊपरी सीमा धीरे-धीरे ऊपर की ओर बढ़ेगी, निचली सीमा भी ऊपर की ओर बढ़ेगी, लेकिन कम।

  • यदि न्यूनतम मूल्य ≤ निचली सीमा है और समापन मूल्य < उद्घाटन मूल्य है, तो निचली सीमा धीरे-धीरे नीचे जाती है, ऊपरी सीमा भी नीचे जाती है, लेकिन कम है।

स्थानीय रुझानों और टर्निंग पॉइंट्स को स्पष्ट रूप से चार्ट पर देखने के लिए विचलन को समायोजित करें। यह मूल्य आंदोलनों को ट्रैक करने के लिए एक बहुत ही उपयोगी उपकरण है।

श्रेष्ठता विश्लेषण

  • मूल्य परिवर्तन के रुझान को दर्शाने के लिए समर्थन और प्रतिरोध की स्पष्ट पहचान करें।

  • समकोण रेखा स्पष्ट रूप से दरार की ताकत और प्रतिध्वनि की सीमा को दर्शाती है।

  • प्रवृत्तियों को अलग-अलग तीव्रता के अनुसार पहचाना जा सकता है जिन्हें कोण रेखा के झुकाव को समायोजित करने की आवश्यकता होती है।

  • यह एक ऐसा क्षेत्र है जहां आप एक बड़ा समर्थन या प्रतिरोध पा सकते हैं और इसे तोड़ सकते हैं।

  • इस प्रकार, यह मूल्य परिवर्तन की गति को आसानी से देख सकता है, जिससे स्थिति को समायोजित किया जा सकता है।

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

  • एक समकोण रेखा एक पूर्ण सटीक भविष्यवाणी नहीं कर सकती है कि आगे क्या होगा।

  • हालांकि, यह ध्यान दिया जाना चाहिए कि प्रवृत्ति में विचलन हो सकता है, जो वास्तविक कीमतों के विपरीत है।

  • यह एक अलग रणनीति के रूप में इस्तेमाल नहीं किया जा सकता है, यह अन्य संकेतकों के साथ संयोजन में बड़े रुझानों का आकलन करने के लिए आवश्यक है।

  • ध्यान रखें कि पैरामीटर को गलत तरीके से समायोजित करने से बहुत अधिक लेनदेन हो सकता है।

  • एक बार जब आप अपने वाहन को वापस बुलाते हैं, तो आपको चेतावनी की आवश्यकता होती है, और इसे मैकेनिकल ब्लाइंड ट्रैक नहीं किया जा सकता है।

बड़े रुझानों के तहत संचालन के लिए, अन्य संकेतकों को सहायक निर्णय के रूप में संदर्भित करते हुए, स्थिति के आकार को उचित रूप से छोटा किया जा सकता है।

अनुकूलन दिशा

  • प्रवृत्ति के विभिन्न चरणों में गतिशील रूप से स्थिति को समायोजित करने के लिए स्थिति प्रबंधन मॉड्यूल जोड़ा जा सकता है।

  • उतार-चढ़ाव के संकेतकों के साथ संयोजन, जब उतार-चढ़ाव बढ़ जाता है तो स्थिति को कम किया जा सकता है

  • स्टॉप लॉस को एक वापसी अनुपात के आधार पर सेट किया जा सकता है, जिससे एकल नुकसान को नियंत्रित किया जा सकता है।

  • फ़िल्टर जोड़े जा सकते हैं, जो मूल्य विचलन पर व्यापार को रोक सकते हैं।

  • प्रवृत्ति परिवर्तनों को पहचानने के लिए बहु-स्तरीय समकोण ढलानों को विभाजित किया जा सकता है।

गतिशील रूप से स्थिति को समायोजित करके, स्टॉप लॉस और फ़िल्टरिंग स्थितियों को सेट करके, मूल्य रुझानों को अधिक स्थिरता से ट्रैक किया जा सकता है।

संक्षेप

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

रणनीति स्रोत कोड
/*backtest
start: 2023-10-06 00:00:00
end: 2023-11-05 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
// **********************************************************************************
// This code is invented and written by @StCogitans.
// The idea presented in this code and the rights to this code belong to @StCogitans.
// © https://www.tradingview.com/u/StCogitans
//
// Description.
// Sizeblock - a price change strategy in the form of diagonal rows.
// **********************************************************************************

// STRATEGY
string NAME        = 'Sizeblock'
string ACRONYM     = 'SB'
bool OVERLAY       = true
int PYRAMIDING     = 0
string QTY_TYPE    = strategy.percent_of_equity
float QTY_VALUE    = 100
float CAPITAL      = 100
string COM_TYPE    = strategy.commission.percent
float COM_VALUE    = 0.1
bool ON_CLOSE      = false
bool BAR_MAGNIFIER = false
bool OHLC          = true
strategy(NAME, ACRONYM, OVERLAY, pyramiding=PYRAMIDING, default_qty_type=QTY_TYPE, default_qty_value=QTY_VALUE, initial_capital=CAPITAL, commission_type=COM_TYPE, commission_value=COM_VALUE, process_orders_on_close=ON_CLOSE, use_bar_magnifier=BAR_MAGNIFIER, fill_orders_on_standard_ohlc=OHLC)

// ARGUMENTS
// Datetime
DTstart  = input(timestamp("01 Jan 2000 00:00 +0000"), 'Start time', group='Datetime')
DTfinish = input(timestamp("01 Jan 2080 23:59 +0000"), 'Finish time', group='Datetime')
DTperiod = true

// Main
dev_source = input.string('Close', title='Source', options=["Close", "HighLow"], tooltip='Price data for settlement.', group='Main')
dev_type   = input.string('Percentage', title='Deviation', options=['Percentage', 'Ticks'], tooltip='The type of deviation to calculate.', group='Main')
dev_value  = input.float(1, title='Quantity', minval=0.001, step=0.01, tooltip='Quantity to be calculated.', group='Main')
dev_back   = input.float(2, title='U-turn', minval=0.001, step=0.01, tooltip='Quantity for reversal.', group='Main')
mode       = input.string('Limit', title='Positions', options=['Limit', 'Market'], tooltip='Limit or market orders.', group='Main')
direct     = input.string('All', title='Direction', options=['All', 'Buy', 'Sell'], tooltip='The type of positions to be opened.', group='Main')
swapping   = input.bool(false, title='Swapping', tooltip='Swap points to open a new position.', group='Main')

// CALCULATION SYSTEM
Assembling(s, t, v, vb) =>

    float a = open
    float b = close
    float c = s == "HighLow" ? math.round_to_mintick(high) : math.round_to_mintick(b)
    float d = s == "HighLow" ? math.round_to_mintick(low) : math.round_to_mintick(b)

    float x = math.round_to_mintick(a)
    x := nz(x[1], x)

    float _v = t == "Ticks" ? syminfo.mintick * v : v
    float _vb = t == "Ticks" ? syminfo.mintick * vb : vb

    float h = t == "Ticks" ? math.round_to_mintick(x + _v) : math.round_to_mintick(x * (1 + _v / 100))
    float l = t == "Ticks" ? math.round_to_mintick(x - _v) : math.round_to_mintick(x * (1 - _v / 100))
    h := nz(h[1], h)
    l := nz(l[1], l)

    if t == "Ticks"
    
        if c >= h and b > a
            while c >= h
            
                x := h
                h := math.round_to_mintick(h + _v)
                l := math.round_to_mintick(x - _vb)
        
        if d <= l and b < a
            while d <= l
            
                x := l
                l := math.round_to_mintick(l - _v)
                h := math.round_to_mintick(x + _vb)

    else if t == "Percentage"
    
        if c >= h and b > a
            while c >= h
        
                x := h
                h := math.round_to_mintick(h * (1 + _v / 100))
                l := math.round_to_mintick(x * (1 - _vb / 100))

        if d <= l and b < a
            while d <= l
        
                x := l
                l := math.round_to_mintick(l * (1 - _v / 100))
                h := math.round_to_mintick(x * (1 + _vb / 100))

    [x, h, l]

[lx, lh, ll] = Assembling(dev_source, dev_type, dev_value, dev_back)

// PLOT
// Lines
plot_up   = plot(lh, color=color.new(color.green, 50), style=plot.style_line, linewidth=1)
plot_main = plot(lx, color=color.new(color.silver, 50), style=plot.style_line, linewidth=1)
plot_down = plot(ll, color=color.new(color.red, 50), style=plot.style_line, linewidth=1)

// Areas
fill(plot_up, plot_main, lh, lx, color.new(color.teal, 80), color.new(color.teal, 80))
fill(plot_main, plot_down, lx, ll, color.new(color.maroon, 80), color.new(color.maroon, 80))

// TRADING
// Alert variables
int Action = -1
int PosType = -1
int OrderType = -1
float Price = -1.0

// Direction variables
bool ifBuy = direct == "All" or direct == "Buy" ? true : false
bool ifSell = direct == "All" or direct == "Sell" ? true : false

// Market entries
if (strategy.closedtrades + strategy.opentrades == 0 or mode == "Market") and DTperiod
    if ((swapping and lx < nz(lx[1], lx)) or (not swapping and lx > nz(lx[1], lx))) and ifBuy
        Action := 1
        PosType := 1
        OrderType := 1
        Price := math.round_to_mintick(close)
        strategy.entry('Long', strategy.long)
    if ((swapping and lx > nz(lx[1], lx)) or (not swapping and lx < nz(lx[1], lx))) and ifSell
        Action := 2
        PosType := 2
        OrderType := 1
        Price := math.round_to_mintick(close)
        strategy.entry('Short', strategy.short)

// Closing positions by market
if DTperiod and mode == "Market"
    if direct == "Buy" and strategy.position_size > 0
        if swapping and lx > nz(lx[1], lx)
            Action := 2
            PosType := 3
            OrderType := 1
            Price := math.round_to_mintick(close)
            strategy.close('Long', comment='Close')
        if not swapping and lx < nz(lx[1], lx)
            Action := 2
            PosType := 3
            OrderType := 1
            Price := math.round_to_mintick(close)
            strategy.close('Long', comment='Close')
    if direct == "Sell" and strategy.position_size < 0
        if swapping and lx < nz(lx[1], lx)
            Action := 1
            PosType := 3
            OrderType := 1
            Price := math.round_to_mintick(close)
            strategy.close('Short', comment='Close')
        if not swapping and lx > nz(lx[1], lx)
            Action := 1
            PosType := 3
            OrderType := 1
            Price := math.round_to_mintick(close)
            strategy.close('Short', comment='Close')

// Limit entries and exits
if swapping and DTperiod and mode == "Limit"
    if strategy.position_size < 0
        Action := 1
        PosType := 1
        OrderType := 2
        Price := ll
        if ifBuy
            strategy.entry('Long', strategy.long, limit=ll)
        else
            PosType := 3
            strategy.exit('Exit', limit=ll)
    if strategy.position_size > 0
        Action := 2
        PosType := 2
        OrderType := 2
        Price := lh
        if ifSell
            strategy.entry('Short', strategy.short, limit=lh)
        else
            PosType := 3
            strategy.exit('Exit', limit=lh)
    if strategy.closedtrades + strategy.opentrades > 0 and strategy.position_size == 0
        if ifBuy
            Action := 1
            PosType := 1
            OrderType := 2
            Price := ll
            strategy.entry('Long', strategy.long, limit=ll)
        if ifSell
            Action := 2
            PosType := 2
            OrderType := 2
            Price := lh
            strategy.entry('Short', strategy.short, limit=lh)
if not swapping and DTperiod and mode == "Limit"
    if strategy.position_size < 0
        Action := 1
        PosType := 1
        OrderType := 2
        Price := lh
        if ifBuy
            strategy.entry('Long', strategy.long, stop=lh)
        else
            PosType := 3
            strategy.exit('Exit', stop=lh)
    if strategy.position_size > 0
        Action := 2
        PosType := 2
        OrderType := 2
        Price := ll
        if ifSell
            strategy.entry('Short', strategy.short, stop=ll)
        else
            PosType := 3
            strategy.exit('Exit', stop=ll)
    if strategy.closedtrades + strategy.opentrades > 0 and strategy.position_size == 0
        if ifBuy
            Action := 1
            PosType := 1
            OrderType := 2
            Price := lh
            strategy.entry('Long', strategy.long, stop=lh)
        if ifSell
            Action := 2
            PosType := 2
            OrderType := 2
            Price := ll
            strategy.entry('Short', strategy.short, stop=ll)

// Everything is closed and canceled
if not DTperiod
    strategy.cancel_all()
    strategy.close_all(comment='Close')

// Alerts
// Convert to string variables
string Action_Txt = Action == 1 ? "Buy" : Action == 2 ? "Sell" : na
string PosType_Txt = PosType == 1 ? "Long" : PosType == 2 ? "Short" : PosType == 3 ? "Flat" : na
string OrderType_Txt = OrderType == 1 ? "Market" : OrderType == 2 ? "Limit" : na
string Price_Txt = Price > 0 ? str.tostring(Price) : na

// Output
if not (Action == nz(Action[1], Action) and Price == nz(Price[1], Price) and OrderType == nz(OrderType[1], OrderType)) and DTperiod
    alert('{"pair": "' + syminfo.ticker + '", "direction": "' + Action_Txt + '", "entertype": "' + OrderType_Txt + '", "position": "' + PosType_Txt + '", "price": "' + Price_Txt + '"}')

// *********************
// Good job, Soldier! ;>
// *********************