প্রগতিশীল লাভের কৌশল

লেখক:চাওঝাং, তারিখ: ২০২৩-১০-২৪ ১৪ঃ১৪
ট্যাগঃ

img

প্রগতিশীল লাভের কৌশল

সারসংক্ষেপ

এই কৌশলটি RSI সূচক এবং দামের চলমান গড়ের সংমিশ্রণ করে যখন দাম চলমান গড় রেখার নীচে ভাঙবে তখন ওভারসোল্ড সুযোগগুলি সনাক্ত করতে। যখন দাম আরও হ্রাস পায়, তখন কৌশলটি ব্যয় গড় অর্জনের জন্য পূর্বনির্ধারিত শতাংশের উপর ভিত্তি করে ধীরে ধীরে আরও দীর্ঘ পজিশনকে পিরামিড করবে। যখন পজিশনের মুনাফা কনফিগার করা লাভের শতাংশে পৌঁছে যায়, তখন কৌশলটি পজিশনগুলি বন্ধ করবে। এটি একটি প্রগতিশীল লাভের প্রক্রিয়াও প্রবর্তন করে যা প্রতি পজিশন লাভের ভিত্তিতে সামগ্রিক স্টপ লাভের দামকে গতিশীলভাবে সামঞ্জস্য করে। এটি কার্যকরভাবে ক্ষতির ঝুঁকি হ্রাস করতে এবং ধীরে ধীরে প্রস্থান অর্জন করতে পারে।

কৌশলগত যুক্তি

  1. যখন আরএসআই ২৯ এর ওভারসোল্ড লাইনের নিচে নেমে আসে এবং বন্ধের মূল্য চলমান গড়ের নিচে থাকে, তখন প্রথম লং পজিশনটি খুলুন।

  2. যখন দাম প্রথম এন্ট্রি মূল্যের নিচে ২% কমে যায়, তখন সর্বোচ্চ ৮টি এন্ট্রি না হওয়া পর্যন্ত দ্বিতীয় লং পজিশন যোগ করুন। এটি ডলারের খরচ গড় অর্জন করে।

  3. প্রতিটি এন্ট্রি পরে, এন্ট্রি মূল্য রেকর্ড করুন। এই দামগুলি এন্ট্রিগুলির জন্য রেফারেন্স মূল্য হিসাবে কাজ করে। চার্টে লাইন হিসাবে তাদের প্লট করুন।

  4. এন্ট্রি করার পরে, গড় হোল্ডিং মূল্য গণনা করুন। প্রতিটি পজিশনের জন্য গড় মূল্যের 3% এবং সামগ্রিক পজিশনের জন্য 4% লাভ হিসাবে ব্যবহার করুন।

  5. যখন মূল্য পজিশনের মুনাফা নেওয়ার দামের উপরে উঠে যায়, তখন পজিশনটি বন্ধ করুন।

  6. প্রগতিশীল লাভের হিসাবঃ প্রতিটি অবস্থান বন্ধ করার পরে, সামগ্রিক লাভের মূল্য থেকে উপলব্ধ লাভ কেটে ফেলুন। এটি ধীরে ধীরে লাভের লাইনটি টেনে নিচে নিয়ে যায়। যখন মোট লাভ সর্বাধিক ক্ষতি কভার করে তখনই কৌশলটি সম্পূর্ণ লাভ করবে।

  7. যখন মূল্য প্রগতিশীল লাভের রেখা স্পর্শ করে, সব পজিশন বন্ধ করুন।

সুবিধা

  1. আরএসআই ওভারসোল্ড/ওভারকুপেড জোন চিহ্নিত করতে ভালো, যা বিপরীতমুখী অবস্থার জন্য ভালো প্রবেশের অনুমতি দেয়।

  2. একাধিক এন্ট্রি কম দামে খরচ গড় অনুমোদন করে।

  3. ধীরে ধীরে লাভ নেয়া ঝুঁকি হ্রাস করে এবং ধীরে ধীরে প্রস্থান অর্জন করে।

  4. কাস্টমাইজযোগ্য লাভের হার এবং প্রবেশের ধাপগুলি ঝুঁকি সামঞ্জস্যের অনুমতি দেয়।

  5. প্লট এন্ট্রি এবং লভ্যাংশ লাইন পজিশন উপর চাক্ষুষ নির্দেশিকা প্রদান।

ঝুঁকি

  1. Whipsaw বাজারগুলি অত্যধিক প্রবেশ এবং প্রস্থানকে ট্রিগার করতে পারে, যা স্লিপিংয়ের কারণ হতে পারে। বাণিজ্য হ্রাস করার জন্য RSI পরিসীমা প্রসারিত করুন।

  2. এন্ট্রি স্টেপ এবং অনুপাতের ভুল কনফিগারেশন অতিরিক্ত ট্রেডিংয়ের কারণ হতে পারে। অ্যাকাউন্টের আকারের উপর ভিত্তি করে সতর্ক থাকুন।

  3. হ্রাসের সময় পিরামিডিং চালিয়ে যাওয়া সীমাহীন ক্ষতির ঝুঁকি নিয়ে আসে। প্রবেশের সর্বোচ্চ সীমা নির্ধারণ করুন। শেষ প্রবেশ সংরক্ষণশীল রাখুন।

  4. খুব সংকীর্ণ মুনাফা সেট করুন অকাল প্রস্থান হতে পারে। ব্যাকটেস্ট ডেটা উপর ভিত্তি করে অপ্টিমাইজ করুন।

উন্নতি

  1. খারাপ আরএসআই সিগন্যাল এড়ানোর জন্য এমএসিডি এর মত ফিল্টার যোগ করুন।

  2. ATR এর উপর ভিত্তি করে স্টপ লস অন্তর্ভুক্ত করুন যাতে চরম ক্ষতির ঘটনা সীমাবদ্ধ থাকে।

  3. বিভিন্ন সম্পদের জন্য প্রবেশ, লাভ এবং অন্যান্য পরামিতিগুলি অনুকূল করুন।

  4. অস্থিরতার উপর ভিত্তি করে মুনাফা নিতে গতিশীলভাবে সামঞ্জস্য করুন। অস্থির হলে প্রসারিত করুন।

সিদ্ধান্ত

এই কৌশলটি ওভারসোল্ড সনাক্তকরণের জন্য আরএসআই সম্পূর্ণরূপে ব্যবহার করে, বিপরীত ট্রেডিংয়ের জন্য এমএ এর সাথে একত্রিত করে। পিরামিডিং এবং প্রগতিশীল লাভ গ্রহণের প্রক্রিয়াগুলি কার্যকর দীর্ঘ এন্ট্রিগুলির অনুমতি দেওয়ার সময় ঝুঁকি নিয়ন্ত্রণ করে। সূচক, লাভ গ্রহণ ইত্যাদির উপর আরও অপ্টিমাইজেশন কৌশলটিকে আরও শক্তিশালী করতে পারে। এটি ব্যাপকভাবে প্রয়োগ করা যেতে পারে ট্রেন্ডিং যন্ত্র যেমন সূচক ফিউচার এবং ক্রিপ্টো মহান বিনিয়োগ মূল্যের জন্য।


/*backtest
start: 2023-09-23 00:00:00
end: 2023-10-23 00:00:00
period: 1h
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/
//@version=5
// © A3Sh

// RSI Strategy that buys the dips, uses Price Averaging and Pyramiding.
// When the price drops below specified percentages of the price (8 PA layers), new entries are openend to average the price of the assets.
// Open entries are closed by a specified take profit.
// Entries can be reopened, after closing and consequently crossing a PA layer again.
// This strategy is based on the RSI+PA+DCA strategy I created earlier. The difference is the way the Take Profit is calculated.
// Instead of directly connecting the take profit limit to the decreasing average price level with an X percent above the average price, 
// the take profit is calculated for a part on the decreasing average price and for another part on the deduction 
// of the profits of the individual closed positions.
// The Take Profit Limit drop less significant then the average price level and the full position only completely exits 
// when enough individual closed positions made up for the losses.
// This makes it less risky and more conservative and great for a long term trading strategy
// RSI code is adapted from the build in Relative Strength Index indicator
// MA Filter and RSI concept adapted from the Optimized RSI Buy the Dips strategy, by Coinrule
// https://www.tradingview.com/script/Pm1WAtyI-Optimized-RSI-Strategy-Buy-The-Dips-by-Coinrule/
// Pyramiding entries code adapted from Pyramiding Entries on Early Trends startegy, by Coinrule
// Pyramiding entries code adapted from Pyramiding Entries on Early Trends startegy, by Coinrule
// https://www.tradingview.com/script/7NNJ0sXB-Pyramiding-Entries-On-Early-Trends-by-Coinrule/
// Plot entry layers code adapted from HOWTO Plot Entry Price by vitvlkv
// https://www.tradingview.com/script/bHTnipgY-HOWTO-Plot-Entry-Price/


strategy(title='RSI+PA+PTP', pyramiding=16, overlay=true, initial_capital=400, default_qty_type=strategy.percent_of_equity, default_qty_value=15, commission_type=strategy.commission.percent, commission_value=0.075, close_entries_rule='FIFO')

port = input.float(12, group = "Risk", title='Portfolio % Used To Open The 8 Positions', step=0.1, minval=0.1, maxval=100)
q    = strategy.equity / 100 * port / open


// Long position PA entry layers. Percentage from the entry price of the the first long
ps2 = input.float(2,  group = "Long Position Entry Layers", title='2nd Long Entry %', step=0.1)
ps3 = input.float(3,  group = "Long Position Entry Layers", title='3rd Long Entry %', step=0.1)
ps4 = input.float(5,  group = "Long Position Entry Layers", title='4th Long Entry %', step=0.1)
ps5 = input.float(10, group = "Long Position Entry Layers", title='5th Long Entry %', step=0.1)
ps6 = input.float(16, group = "Long Position Entry Layers", title='6th Long Entry %', step=0.1)
ps7 = input.float(25, group = "Long Position Entry Layers" ,title='7th Long Entry %', step=0.1)
ps8 = input.float(40, group = "Long Position Entry Layers", title='8th Long Entry %', step=0.1)


// Calculate Moving Averages
plotMA               = input.bool(group = "Moving Average Filter", title='Plot Moving Average', defval=false)
movingaverage_signal = ta.sma(close, input(100, group = "Moving Average Filter", title='MA Length'))

plot (plotMA ? movingaverage_signal : na, color = color.new (color.green, 0))


// RSI inputs and calculations
rsiLengthInput = input.int(14, minval=1, title="RSI Length", group="RSI Settings")
rsiSourceInput = input.source(close, "Source", group="RSI Settings")

up   = ta.rma(math.max(ta.change(rsiSourceInput), 0), rsiLengthInput)
down = ta.rma(-math.min(ta.change(rsiSourceInput), 0), rsiLengthInput)
rsi  = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))

overSold = input.int(29, title="Oversold, Trigger to Enter First Position", group = "RSI Settings")

// Long trigger (co)
co = ta.crossover(rsi, overSold) and close < movingaverage_signal


// Store values to create and plot the different PA layers
long1 = ta.valuewhen(co, close, 0)
long2 = ta.valuewhen(co, close - close / 100 * ps2, 0)
long3 = ta.valuewhen(co, close - close / 100 * ps3, 0)
long4 = ta.valuewhen(co, close - close / 100 * ps4, 0)
long5 = ta.valuewhen(co, close - close / 100 * ps5, 0)
long6 = ta.valuewhen(co, close - close / 100 * ps6, 0)
long7 = ta.valuewhen(co, close - close / 100 * ps7, 0)
long8 = ta.valuewhen(co, close - close / 100 * ps8, 0)

eps1 = 0.00
eps1 := na(eps1[1]) ? na : eps1[1]

eps2 = 0.00
eps2 := na(eps2[1]) ? na : eps2[1]

eps3 = 0.00
eps3 := na(eps3[1]) ? na : eps3[1]

eps4 = 0.00
eps4 := na(eps4[1]) ? na : eps4[1]

eps5 = 0.00
eps5 := na(eps5[1]) ? na : eps5[1]

eps6 = 0.00
eps6 := na(eps6[1]) ? na : eps6[1]

eps7 = 0.00
eps7 := na(eps7[1]) ? na : eps7[1]

eps8 = 0.00
eps8 := na(eps8[1]) ? na : eps8[1]

plot(strategy.position_size > 0 ? eps1 : na, title='Long entry 1', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps2 : na, title='Long entry 2', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps3 : na, title='Long entry 3', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps4 : na, title='Long entry 4', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps5 : na, title='Long entry 5', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps6 : na, title='Long entry 6', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps7 : na, title='Long entry 7', style=plot.style_linebr)
plot(strategy.position_size > 0 ? eps8 : na, title='Long entry 8', style=plot.style_linebr)


// Take Profit Settings
ProfitTarget_Percent     = input.float(3.0,   group = "Take Profit Settings", title='Take Profit % (Per Position)')
ProfitTarget_Percent_All = input.float(4.0,   group = "Take Profit Settings", title='Take Profit % (Exit All, Progressive Take Profit Limit')
TakeProfitProgression    = input.float(12,    group = "Take Profit Settings", title='Take Profit Progression', tooltip = 'Progression is defined by the position size. By default 12% of the start equity (portfolio) is used to open a position, see Risk. This same % percentage is used to calculate the profit amount that will be deducted from the Take Profit Limit.')
entryOn                  = input.bool (true,  group = "Take Profit Settings", title='New entries affect Take Profit limit', tooltip = 'This option changes the behaviour of the Progressive Take Profit. When switchted on, the difference between the former and current original Take Profit is deducted from the Progressive Take Profit. When switchted off, the Progressive Take Profit is only affected by the profit deduction or each closed position.')
avPricePlot              = input.bool (false, group = "Take Profit Settings", title='Plot Average Price (FIFO)')
// Original Take Profit Limit
tpLimit                  = strategy.position_avg_price + (strategy.position_avg_price / 100 * ProfitTarget_Percent_All) 


// Create variables to calculate the Take Profit Limit Progresssion
var endVal   = 0.0   
var startVal = 0.0

// The value at the the start of the loop is the value of the end of the previous loop
startVal := endVal 

// Set variable to the original Take Profit Limit when the first position opens.
if strategy.position_size > 0 and strategy.position_size[1] ==0
    endVal := tpLimit  

// Everytime a specific position opens, the difference of the previous (original) Take Profit price and the current (original) Take Profit price will be deducted from the Progressive Take Profit Limit
// This feature can be toggled on and off in the settings panel. By default it is toggled on.
entryAmount = 0.0
for i = 1 to strategy.opentrades
    entryAmount := i
    if entryOn  and strategy.position_size > 0 and strategy.opentrades[1] == (entryAmount) and strategy.opentrades == (entryAmount + 1)
        endVal := startVal - (tpLimit[1] - tpLimit)

// Everytime a specific position closes, the amount of profit from that specific position will be deducted from the Progressive Take Profit Limit.
exitAmount = 0.0
for id = 1 to strategy.opentrades
    exitAmount := id
    if strategy.opentrades[1] ==(exitAmount + 1) and strategy.opentrades == (exitAmount)
        endVal := startVal - (TakeProfitProgression / 100 * strategy.opentrades.entry_price (id - 1) / 100 * ProfitTarget_Percent )

// The Final Take Profit Price
tpn = (strategy.position_avg_price + (strategy.position_avg_price / 100 * ProfitTarget_Percent_All))  - (strategy.position_avg_price + (strategy.position_avg_price / 100 * ProfitTarget_Percent_All) - endVal)
plot  (strategy.position_size > 0 ? tpn : na, title = "Take Profit Limit", color=color.new(color.red, 0), style = plot.style_linebr, linewidth = 1) 

// Plot position average price as reference
plot  (avPricePlot ? strategy.position_avg_price : na, title= "Average price", color = color.new(color.white, 0), style = plot.style_linebr, linewidth = 1) 


// When to trigger the Take Profit per position or the Progressive Take Profit
tpl1 = close < tpn ? eps1 + close * (ProfitTarget_Percent / 100) : tpn
tpl2 = close < tpn ? eps2 + close * (ProfitTarget_Percent / 100) : tpn
tpl3 = close < tpn ? eps3 + close * (ProfitTarget_Percent / 100) : tpn
tpl4 = close < tpn ? eps4 + close * (ProfitTarget_Percent / 100) : tpn
tpl5 = close < tpn ? eps5 + close * (ProfitTarget_Percent / 100) : tpn
tpl6 = close < tpn ? eps6 + close * (ProfitTarget_Percent / 100) : tpn
tpl7 = close < tpn ? eps7 + close * (ProfitTarget_Percent / 100) : tpn
tpl8 = close < tpn ? eps8 + close * (ProfitTarget_Percent / 100) : tpn



// Submit Entry Orders
if co and strategy.opentrades == 0
    eps1 := long1
    eps2 := long2
    eps3 := long3
    eps4 := long4
    eps5 := long5
    eps6 := long6
    eps7 := long7
    eps8 := long8

    strategy.entry('Long1', strategy.long, q)

if strategy.opentrades == 1
    strategy.entry('Long2', strategy.long, q, limit=eps2)

if strategy.opentrades == 2
    strategy.entry('Long3', strategy.long, q, limit=eps3)

if strategy.opentrades == 3
    strategy.entry('Long4', strategy.long, q, limit=eps4)

if strategy.opentrades == 4
    strategy.entry('Long5', strategy.long, q, limit=eps5)

if strategy.opentrades == 5
    strategy.entry('Long6', strategy.long, q, limit=eps6)

if strategy.opentrades == 6
    strategy.entry('Long7', strategy.long, q, limit=eps7)

if strategy.opentrades == 7
    strategy.entry('Long8', strategy.long, q, limit=eps8)



// Submit Exit orders
if strategy.position_size > 0
    strategy.exit(id='Exit 1', from_entry='Long1', limit=tpl1)
    strategy.exit(id='Exit 2', from_entry='Long2', limit=tpl2)
    strategy.exit(id='Exit 3', from_entry='Long3', limit=tpl3)
    strategy.exit(id='Exit 4', from_entry='Long4', limit=tpl4)
    strategy.exit(id='Exit 5', from_entry='Long5', limit=tpl5)
    strategy.exit(id='Exit 6', from_entry='Long6', limit=tpl6)
    strategy.exit(id='Exit 7', from_entry='Long7', limit=tpl7)
    strategy.exit(id='Exit 8', from_entry='Long8', limit=tpl8)


// Make sure that all open limit orders are canceled after exiting all the positions 
longClose = strategy.position_size[1] > 0 and strategy.position_size == 0 ? 1 : 0
if longClose
    strategy.cancel_all()






আরো