रेंज वॉल्यूम डीसीए रणनीति

लेखक:चाओझांग, दिनांक: 2023-09-21 10:41:52
टैगः

अवलोकन

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

रणनीति तर्क

  1. वॉल्यूम स्पाइक्स की पहचान करने के लिए रेंज वॉल्यूम इंडिकेटर का प्रयोग करें
  2. स्पाइक, पिरामिड पर लंबे समय तक जाएं जब कीमत सीमा से नीचे गिरती है
  3. डीसीए मापदंडों की गणना करें जिनमें सुरक्षा आदेश की कीमतें, आकार, अधिकतम सुरक्षा आदेश आदि शामिल हैं।
  4. जब कीमत सुरक्षा आदेश मूल्य स्तरों को ट्रिगर करती है तो सुरक्षा आदेश जोड़ें
  5. लाभ लक्ष्य या अधिकतम सुरक्षा आदेश तक पहुँचने पर लाभ लें

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

लाभ विश्लेषण

  1. रेंज वॉल्यूम प्रविष्टि सटीकता में सुधार करता है
  2. पिरामिड बनाने से निम्न लागत वाले रुझान की अनुमति मिलती है
  3. डीसीए मापदंडों का लचीला विन्यास
  4. लाभ लेने और हानि रोकने के जोखिमों का प्रबंधन

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

  1. विफल मात्रा विश्लेषण में गलत प्रविष्टि का जोखिम होता है
  2. बहुत अधिक पिरामिडिंग लागत और जोखिम बढ़ाती है
  3. समय पर डीसीए पैरामीटर ट्यूनिंग की आवश्यकता होती है
  4. गलत स्टॉप लॉस प्लेसमेंट से नुकसान बढ़ सकता है

मापदंड अनुकूलन, प्रवृत्ति फ़िल्टर आदि जोड़कर जोखिमों को कम किया जा सकता है।

अनुकूलन दिशाएँ

  1. सर्वोत्तम सेटअप के लिए परीक्षण मात्रा पैरामीटर संयोजन
  2. विभिन्न उत्पादों और समय सीमाओं के लिए डीसीए मापदंडों का अनुकूलन करें
  3. मूल्य परिवर्तनों को ट्रैक करने के लिए ट्रेलिंग स्टॉप लॉस जोड़ें
  4. प्रवृत्ति गति पर पुनः प्रवेश करने के लिए पुनः प्रवेश नियम जोड़ें
  5. गलत दिशा प्रविष्टियों से बचने के लिए प्रवृत्ति फ़िल्टर का मूल्यांकन करें
  6. इष्टतम विन्यास खोजने के लिए स्टॉप लॉस एल्गोरिदम की तुलना करें

सारांश

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


/*backtest
start: 2022-09-20 00:00:00
end: 2023-09-20 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
args: [["v_input_8",500]]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ranged Volume DCA Strategy - R3c0nTrader ver 2022-04-19
// For backtesting with 3Commas DCA Bot settings
// Thank you "EvoCrypto" for granting me permission to use "Ranged Volume" to create this strategy
// Thank you "junyou0424" for granting me permission to use "DCA Bot with SuperTrend Emulator" which I used for adding bot inputs, calculations, and strategy
//@version=5
strategy("Ranged Volume DCA Strategy - R3c0nTrader", shorttitle="Ranged Vol DCA Strategy", format=format.volume, overlay=true, pyramiding=999, default_qty_type=strategy.cash, initial_capital=50000, commission_value=0.0)

// INPUTS {
// Start and End Dates
i_startTime = input(defval=timestamp('01 Jan 2015 00:00 +0000'), title='Start Time')
i_endTime = input(defval=timestamp('31 Dec 2050 23:59 +0000'), title='End Time')
inDateRange = true

//Ranged Volume Settings
Range_Length    =   input.int(5,        title="Volume Range Length",                       minval=1)

Heikin_Ashi     =   input(true,     title="Heikin Ashi  (Try toggling for different results)")
Display_Bars    =   input(true,     title="Show Bar Colors")
Display_Break   =   input(true,     title="Show Break-Out")
Display_Range   =   input(true,     title="Show Range")

truncate(number, decimals) =>
    factor = math.pow(10, decimals)
    int(number * factor) / factor

// Strategy Inputs
//sourceInput = input.source(close, "Source")
sourceInput = close
price_deviation = input.float(6.0, title='Price deviation to open safety orders (%)', step=0.25, minval=0.0) / 100
take_profit = input.float(22.0, title='Target Take Profit (%)', step=0.5, minval=0.0) / 100
trailing = input.float(0.0, title='Trailing deviation. Default= 0.0 (%)', step=0.5, minval=0.0) / 100
base_order = input(100.0, title='Base order')
safe_order = input(500.0, title='Safety order')
safe_order_volume_scale = input.float(2.0, step=0.5, title='Safety order volume scale')
safe_order_step_scale = input.float(1.4, step=0.1, title='Safety order step scale')
max_safe_order = input(5, title='Max safety orders')

var current_so = 0
var initial_order = 0.0
var previous_high_value = 0.0
var original_ttp_value = 0.0
// Calculate our key levels
take_profit_level = strategy.position_avg_price * (1 + take_profit)

// }


// SETTINGS {
Close = Heikin_Ashi ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) : close
//Close = Heikin_Ashi ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, close) : sourceInput
Open = Heikin_Ashi ? request.security(ticker.heikinashi(syminfo.tickerid), timeframe.period, open) : open


Positive        =    volume
Negative        =   -volume

Highest         =   ta.highest(volume, Range_Length)
Lowest          =   ta.lowest(-volume, Range_Length)

Up              =   Highest > Highest[1] and Close > Open
Dn              =   Highest > Highest[1] and Close < Open

Volume_Color = 
 Display_Break and Up ? color.new(#ffeb3b, 20) : 
 Display_Break and Dn ? color.new(#f44336, 20) : 
 Close > Open ? color.new(#00c0ff, 20) : 
 Close < Open ? color.new(#0001f6, 20) : na
// }

//Plot bar color for volume range indicator
barcolor(Volume_Color, title='Ranged Volume Bar Coloring: (You must disable bar coloring in any studies you added or this may not work properly)')
//barcolor(Display_Bars ? Volume_Color : na)

//

// First Position
if strategy.position_size == 0 and sourceInput > 0 and (Up) and inDateRange
    strategy.entry('Long @' + str.tostring(sourceInput)+'💎✋🤚', strategy.long, qty=base_order / sourceInput)
    initial_order := sourceInput
    current_so := 1
    previous_high_value := 0.0
    original_ttp_value := 0
    original_ttp_value

threshold = 0.0

if safe_order_step_scale == 1.0
    threshold := initial_order - initial_order * price_deviation * safe_order_step_scale * current_so
    threshold

else if current_so <= max_safe_order
    threshold := initial_order - initial_order * ((price_deviation * math.pow(safe_order_step_scale, current_so) - price_deviation) / (safe_order_step_scale - 1))
    threshold

else if current_so > max_safe_order
    threshold := initial_order - initial_order * ((price_deviation * math.pow(safe_order_step_scale, max_safe_order) - price_deviation) / (safe_order_step_scale - 1))
    threshold
    

// Average Down
if current_so > 0 and sourceInput <= threshold and current_so <= max_safe_order and previous_high_value == 0.0
    strategy.entry('😨🙏 SO ' + str.tostring(current_so) + '@' + str.tostring(sourceInput), direction=strategy.long, qty=safe_order * math.pow(safe_order_volume_scale, current_so - 1) / sourceInput)
    current_so += 1
    current_so

// Take Profit!
if take_profit_level <= sourceInput and strategy.position_size > 0 or previous_high_value > 0.0
    if trailing > 0.0
        if previous_high_value > 0.0
            if sourceInput >= previous_high_value
                previous_high_value := sourceInput
                previous_high_value
            else
                previous_high_percent = (previous_high_value - original_ttp_value) * 1.0 / original_ttp_value
                current_high_percent = (sourceInput - original_ttp_value) * 1.0 / original_ttp_value
                if previous_high_percent - current_high_percent >= trailing
                    strategy.close_all(comment='Close (trailing) @' + str.tostring(truncate(current_high_percent * 100, 3)) + '%')
                    current_so := 0
                    previous_high_value := 0
                    original_ttp_value := 0
                    original_ttp_value
        else
            previous_high_value := sourceInput
            original_ttp_value := sourceInput
            original_ttp_value
    else
        strategy.close_all(comment='💰 Close @' + str.tostring(sourceInput))
        current_so := 0
        previous_high_value := 0
        original_ttp_value := 0
        original_ttp_value

// Plot TP
plot(strategy.position_size > 0 ? take_profit_level : na, style=plot.style_linebr, color=color.green, linewidth=2, title="Take Profit")

// Plot All Safety Order lines except for last one as bright blue
plot(strategy.position_size > 0 and current_so <= max_safe_order and current_so > 0 ? threshold : na, style=plot.style_linebr, color=color.new(#00ffff,0), linewidth=2, title="Safety Order")

// Plot Last Safety Order Line as Red
plot(strategy.position_size > 0 and current_so > max_safe_order ? threshold : na, style=plot.style_linebr, color=color.red, linewidth=2, title="No Safety Orders Left")

// Plot Average Position Price Line as Orange
plot(strategy.position_size > 0 ? strategy.position_avg_price : na, style=plot.style_linebr, color=color.orange, linewidth=2, title="Avg Position Price")

// Fill TP Area and SO Area
h1 = plot(strategy.position_avg_price, color=color.new(#000000,100), title="Avg Price Plot Area", display=display.none, editable=false)
h2 = plot(take_profit_level, color=color.new(#000000,100), title="Take Profit Plot Area", display=display.none, editable=false)
h3 = plot(threshold, color=color.new(#000000,100), title="SO Plot Area", display=display.none, editable=false)

// TP Area
fill(h1,h2,color=color.new(#38761d,70), title="Take Profit Plot Area")
// Current SO Area
fill(h1,h3,color=color.new(#3d85c6,70), title="SO Plot Area")

अधिक