মুভিং মিডিয়ার উপর ভিত্তি করে গড় রিভার্সন ট্রেডিং কৌশল

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

img

সারসংক্ষেপ

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

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

কৌশলটি প্রথমে একটি নির্দিষ্ট সময়ের মধ্যে একটি চলমান গড় গণনা করে যা দীর্ঘমেয়াদী মূল্য প্রবণতা উপস্থাপন করে। তারপর এটি চলমান গড় থেকে মূল্যের বিচ্যুতির উপর ভিত্তি করে অবস্থানের সময় এবং আকার নির্ধারণ করে।

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

একইভাবে, যখন মূল্য চলমান গড়ের উপরে একটি থ্রেশহোল্ড দ্বারা বৃদ্ধি পায়, তখন শর্ট পজিশন তৈরি হয়। যখন মূল্য চলমান গড়ের দিকে ফিরে যায়, তখন মুনাফা নিয়ে শর্ট পজিশন বন্ধ হয়।

সুবিধা বিশ্লেষণ

  1. শেয়ারের দামের দীর্ঘমেয়াদী ভারসাম্য প্রবণতা অনুসরণ করতে এবং প্রধান প্রবণতা দিক চিহ্নিত করতে চলমান গড়ের প্রবণতা সনাক্তকরণের ক্ষমতা ব্যবহার করুন।

  2. পজিশনে স্কেলিং করে গড় খরচ কমিয়ে ভালো এন্ট্রি প্রাইস পাওয়া যায়।

  3. ঝুঁকি কমাতে বিভিন্ন স্তরের গড় রিভার্সনে মুনাফা নিশ্চিত করতে পর্যায়ক্রমিক মুনাফা গ্রহণ করুন।

  4. একক ট্রেড ক্ষতির আকার সীমাবদ্ধ করার জন্য স্থির শতাংশ দ্বারা নিয়ন্ত্রণ পজিশনের আকার।

  5. বিভিন্ন পণ্যের উপর নির্ভর করে চলমান গড় সময়কাল এবং অবস্থানের আকারের মতো নমনীয় পরামিতি সেটিংস।

ঝুঁকি বিশ্লেষণ

  1. দামের ওশিলেশনের সময় ঘন ঘন স্টপ লস। স্টপ লস পরিসীমা প্রসারিত করতে পারে বা অন্যান্য ফিল্টার যুক্ত করতে পারে।

  2. একটি শক্তিশালী প্রবণতা চলমান গড়ের মাধ্যমে ভেঙে যেতে পারে, গড় বিপরীতমুখী বন্ধ করতে অক্ষম। প্রবণতা শক্তি সূচক দ্বারা চিহ্নিত অবস্থান আকার হ্রাস করতে পারে।

  3. অনুপযুক্ত প্যারামিটার সেটিংগুলি অত্যধিক আক্রমণাত্মক এন্ট্রি বা স্টপগুলির ফলে হতে পারে। বাজারের অবস্থার উপর ভিত্তি করে সাবধানতার সাথে ব্যাকটেস্টিং এবং সমন্বয় প্রয়োজন।

  4. উচ্চ ট্রেডিং ফ্রিকোয়েন্সি উল্লেখযোগ্য ট্রেডিং খরচ নিয়ে আসে। প্যারামিটার অপ্টিমাইজেশনে খরচ ফ্যাক্টর বিবেচনা করা উচিত।

উন্নতির দিকনির্দেশ

  1. পণ্যের বৈশিষ্ট্য অনুসারে চলমান গড় সময়ের অনুকূলিতকরণ।

  2. ঝুঁকি এবং রিটার্নের ভারসাম্য বজায় রাখার জন্য পজিশনের আকারকে অনুকূল করুন।

  3. অপ্রয়োজনীয় লেনদেন এড়াতে অন্যান্য প্রযুক্তিগত ফিল্টার যুক্ত করুন।

  4. বাজারের ওঠানামা স্তরের উপর ভিত্তি করে পজিশনের আকার সামঞ্জস্য করার জন্য অস্থিরতা পরিমাপ অন্তর্ভুক্ত করুন।

  5. ঝুঁকি কমাতে এবং রিটার্ন বাড়াতে লাভের লক্ষ্যমাত্রা স্কেলিং চালু করুন।

সিদ্ধান্ত

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


/*backtest
start: 2022-10-19 00:00:00
end: 2023-10-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("YJ Mean Reversion", overlay=true)
//Was designed firstly to work on an index like the S&P 500 , which over time tends to go up in value. 
//Avoid trading too frequently (e.g. Daily, Weekly), to avoid getting eaten by fees. 
//If you change the underlying asset, or time frame, tweaking the moving average may be necessary. 
//Can work with a starting capital of just $1000, optimise the settings as necessary. 
//Accepts floating point values for the amount of units to purchase (e.g. Bitcoin ). 
//If price of units exceeds available capital, script will cancel the buy. 
//Adjusted the input parameters to be more intuitive.

//input variables
movingAverage = input(title="Moving Average (bars)", type=input.integer, defval=28, minval=1, maxval=1000)
//riskPercentage = input(title="Amount to Risk (%)", type=input.integer, defval=1, minval=1, maxval=50)
deviation = input(title="Deviation Increment (%)", type=input.float, defval=5, minval=0.01, maxval=100) / 100
unitsLevel1 = input(title="Level 1 (units)", type=input.float, defval=1, minval=0.0001, maxval=10000)
unitsLevel2 = input(title="Level 2 (units)", type=input.float, defval=2, minval=0.0001, maxval=10000)
unitsLevel3 = input(title="Level 3 (units)", type=input.float, defval=4, minval=0.0001, maxval=10000)
unitsLevel4 = input(title="Level 4 (units)", type=input.float, defval=8, minval=0.0001, maxval=10000)
unitsLevel5 = input(title="Level 5 (units)", type=input.float, defval=16, minval=0.0001, maxval=10000)

//moving average and ma slope (use on weekly chart)
ma = sma(close, movingAverage)
//sl = ma > ma[4]

//units to buy
//amount = riskPercentage / 100 * (strategy.initial_capital + strategy.netprofit)
//units = floor(amount / close)

//mode 1
//strategy.order("buy", true, 1, when = (close < 0.95 * ma) and (strategy.position_size < 10))
//strategy.order("sell", false, strategy.position_size, when = (close > 1.05 * ma) and (strategy.position_size > 0))

//mode 2
//strategy.order("buy", true, 1, when = close < 0.8 * ma)
//strategy.order("sell", false, strategy.position_size, when = (close > 310) and (strategy.position_size > 0))

//mode 3
//strategy.order("buy", true, 1, when = (close < 0.95 * ma) and (close > 0.9 * ma))
//strategy.order("buy", true, 2, when = (close < 0.9 * ma) and (close > 0.85 * ma))
//strategy.order("buy", true, 4, when = (close < 0.85 * ma) and (close > 0.8 * ma))
//strategy.order("buy", true, 8, when = (close < 0.8 * ma) and (close > 0.75 * ma))
//strategy.order("buy", true, 16, when = (close < 0.75 * ma))
//strategy.order("sell", false, strategy.position_size, when = (close > 310) and (strategy.position_size > 0))

//mode 4
//strategy.order("buy", true, 1, when = (close < 0.98 * ma) and (close > 0.96 * ma) and (sl))
//strategy.order("buy", true, 2, when = (close < 0.96 * ma) and (close > 0.94 * ma) and (sl))
//strategy.order("buy", true, 4, when = (close < 0.94 * ma) and (close > 0.92 * ma) and (sl))
//strategy.order("buy", true, 8, when = (close < 0.92 * ma) and (close > 0.90 * ma) and (sl))
//strategy.order("buy", true, 16, when = (close < 0.90 * ma) and (sl))
//strategy.order("sell", false, strategy.position_size, when = (close > 310) and (strategy.position_size > 0))

//mode 5
//strategy.order("buy", true, 1, when = (close < 0.95 * ma) and (close > 0.9 * ma))
//strategy.order("buy", true, 2, when = (close < 0.9 * ma) and (close > 0.85 * ma))
//strategy.order("buy", true, 4, when = (close < 0.85 * ma) and (close > 0.8 * ma))
//strategy.order("buy", true, 8, when = (close < 0.8 * ma) and (close > 0.75 * ma))
//strategy.order("buy", true, 16, when = (close < 0.75 * ma))

//strategy.order("sell", false, 1, when = (close > 1.05 * ma) and (close < 1.1 * ma) and (strategy.position_size > 0))
//strategy.order("sell", false, 2, when = (close > 1.1 * ma) and (close < 1.15 * ma) and (strategy.position_size > 0))
//strategy.order("sell", false, 4, when = (close > 1.15 * ma) and (close < 1.2 * ma) and (strategy.position_size > 0))
//strategy.order("sell", false, 8, when = (close > 1.2 * ma) and (close < 1.25 * ma) and (strategy.position_size > 0))
//strategy.order("sell", false, 16, when = (close > 1.25 * ma) and (close < 1.3 * ma) and (strategy.position_size > 0))

//mode 6
//strategy.order("B1", true, unitsLevel1 * units, when = (close < 0.95 * ma) and (close > 0.9 * ma))
//strategy.order("B2", true, unitsLevel2 * units, when = (close < 0.9 * ma) and (close > 0.85 * ma))
//strategy.order("B3", true, unitsLevel3 * units, when = (close < 0.85 * ma) and (close > 0.8 * ma))
//strategy.order("B4", true, unitsLevel4 * units, when = (close < 0.8 * ma) and (close > 0.75 * ma))
//strategy.order("B5", true, unitsLevel5 * units, when = (close < 0.75 * ma))

//strategy.order("S1", false, unitsLevel1 * units, when = (close > 1.05 * ma) and (close < 1.1 * ma) and (strategy.position_size > 0))
//strategy.order("S2", false, unitsLevel2 * units, when = (close > 1.1 * ma) and (close < 1.15 * ma) and (strategy.position_size > 0))
//strategy.order("S3", false, unitsLevel3 * units, when = (close > 1.15 * ma) and (close < 1.2 * ma) and (strategy.position_size > 0))
//strategy.order("S4", false, unitsLevel4 * units, when = (close > 1.2 * ma) and (close < 1.25 * ma) and (strategy.position_size > 0))
//strategy.order("S5", false, unitsLevel5 * units, when = (close > 1.25 * ma) and (close < 1.3 * ma) and (strategy.position_size > 0))

//mode 7
//strategy.order("B1", true, units, when = (close < 0.95 * ma) and (close > 0.9 * ma))
//strategy.order("B2", true, units, when = (close < 0.9 * ma) and (close > 0.85 * ma))
//strategy.order("B3", true, units, when = (close < 0.85 * ma) and (close > 0.8 * ma))
//strategy.order("B4", true, units, when = (close < 0.8 * ma) and (close > 0.75 * ma))
//strategy.order("B5", true, units, when = (close < 0.75 * ma))

//strategy.order("S1", false, units, when = (close > 1.05 * ma) and (close < 1.1 * ma) and (strategy.position_size > 0))
//strategy.order("S2", false, units, when = (close > 1.1 * ma) and (close < 1.15 * ma) and (strategy.position_size > 0))
//strategy.order("S3", false, units, when = (close > 1.15 * ma) and (close < 1.2 * ma) and (strategy.position_size > 0))
//strategy.order("S4", false, units, when = (close > 1.2 * ma) and (close < 1.25 * ma) and (strategy.position_size > 0))
//strategy.order("S5", false, units, when = (close > 1.25 * ma) and (close < 1.3 * ma) and (strategy.position_size > 0))

//banding calculations
aH = 1.0 - deviation
aL = aH - deviation
bH = aL
bL = bH - deviation
cH = bL
cL = cH - deviation
dH = cL
dL = dH - deviation
eH = dL
strategy.initial_capital = 50000
//mode 8
strategy.order("B1", true, unitsLevel1, when = (close < aH * ma) and (close > aL * ma) and (unitsLevel1 * close < (strategy.initial_capital + strategy.netprofit)))
strategy.order("B2", true, unitsLevel2, when = (close < bH * ma) and (close > bL * ma) and (unitsLevel2 * close < (strategy.initial_capital + strategy.netprofit)))
strategy.order("B3", true, unitsLevel3, when = (close < cH * ma) and (close > cL * ma) and (unitsLevel3 * close < (strategy.initial_capital + strategy.netprofit)))
strategy.order("B4", true, unitsLevel4, when = (close < dH * ma) and (close > dL * ma) and (unitsLevel4 * close < (strategy.initial_capital + strategy.netprofit)))
strategy.order("B5", true, unitsLevel5, when = (close < eH * ma) and (unitsLevel5 * close < (strategy.initial_capital + strategy.netprofit)))

//banding calculations
fL = 1.0 + deviation
fH = fL + deviation
gL = fH
gH = gL + deviation
hL = gH
hH = hL + deviation
iL = hH
iH = iL + deviation
jL = iH

strategy.order("S1", false, unitsLevel1, when = (close > fL * ma) and (close < fH * ma) and (strategy.position_size > 0))
strategy.order("S2", false, unitsLevel2, when = (close > gL * ma) and (close < gH * ma) and (strategy.position_size > 0))
strategy.order("S3", false, unitsLevel3, when = (close > hL * ma) and (close < hH * ma) and (strategy.position_size > 0))
strategy.order("S4", false, unitsLevel4, when = (close > iL * ma) and (close < iH * ma) and (strategy.position_size > 0))
strategy.order("S5", false, unitsLevel5, when = (close > jL * ma) and (strategy.position_size > 0))

plot(ma, color=#666666, linewidth=5)

আরো