গতিশীল গড় ক্রসওভার কৌশল

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

সারসংক্ষেপ

এই কৌশলটি দ্রুত এবং ধীর গতির গড়ের মধ্যে ক্রসওভার নীতিগুলি ব্যবহার করে বাজারের প্রবণতা দিকনির্দেশগুলি নির্ধারণ করে এবং কিনুন এবং বিক্রয় সংকেত তৈরি করে। কৌশলটি সহজ এবং বাস্তবায়ন করা সহজ, মাঝারি মেয়াদী ব্যবসায়ের জন্য উপযুক্ত।

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

কৌশলটি দুটি চলমান গড়, একটি দ্রুত লাইন এবং একটি ধীর লাইন ব্যবহার করে। দ্রুত লাইনটি 3-দিনের ইএমএ ব্যবহার করে এবং ধীর লাইনটি 15-দিনের ইএমএ ব্যবহার করে। যখন দ্রুত লাইনটি নীচে থেকে ধীর লাইনের উপরে অতিক্রম করে, এটি একটি উর্ধ্বমুখী প্রবণতা নির্দেশ করে এবং একটি ক্রয় সংকেত দেয়। বিপরীতে, যখন দ্রুত লাইনটি উপরে থেকে ধীর লাইনের নীচে অতিক্রম করে, এটি একটি নিম্নমুখী প্রবণতা সংকেত দেয় এবং একটি বিক্রয় সংকেত দেয়।

কৌশলটি দ্রুত প্রস্থান লাইন হিসাবে একটি দ্রুত 3-দিনের ইএমএও সেট করে। যখন মূল্য এই দ্রুত প্রস্থান লাইনের নীচে ভাঙ্গবে, তখন এটি প্রবণতা বিপরীত হয়েছে এবং বিদ্যমান দীর্ঘ অবস্থান থেকে বেরিয়ে আসতে হবে। একইভাবে, যখন মূল্য প্রস্থান লাইনের উপরে ভাঙ্গবে, এটি একটি পুনর্নবীকরণ আপট্রেন্ড নির্দেশ করে এবং আবার দীর্ঘ প্রবেশের সংকেত দেয়।

নির্দিষ্ট অপারেশন সিগন্যাল নির্ধারণ করা হয়ঃ

  1. দ্রুত লাইন নীচে থেকে ধীর লাইন উপরে অতিক্রম করে, দীর্ঘ যান

  2. দ্রুত লাইন নীচে অতিক্রম করে ধীর লাইন উপরে থেকে, সংক্ষিপ্ত যান

  3. দ্রুত প্রস্থান রেখার নিচে মূল্য ভাঙ্গন, দীর্ঘ অবস্থান বন্ধ

  4. দাম দ্রুত প্রস্থান লাইনের উপরে ফিরে আসে, আবার দীর্ঘ প্রবেশ করে

সুবিধা

  • ব্যবহার করা সহজ, শুধুমাত্র দুটি চলন্ত গড় পরামিতি কনফিগার করতে হবে, বাস্তবায়ন সহজ

  • পর্যাপ্ত ব্যাকটেস্টিং ডেটা, কার্যক্ষমতা মূল্যায়নের জন্য সাধারণ সূচক ব্যবহার করে

  • অপ্টিমাইজেশান জন্য অনেক কনফিগারযোগ্য পরামিতি

  • ঝুঁকি নিয়ন্ত্রণের জন্য স্টপ লস হিসাবে দ্রুত প্রস্থান লাইন গ্রহণ করে

  • স্পষ্ট কৌশল যুক্তিবিজ্ঞান, স্পষ্ট ক্রয় এবং বিক্রয় সংকেত

  • অপারেশন ফ্রিকোয়েন্সি যথাযথ, অত্যধিক ট্রেডিং এড়ানো

ঝুঁকি

  • ট্রেন্ড অনুসরণকারী কৌশল হিসাবে প্রবণতা অস্পষ্ট হলে আরও মিথ্যা সংকেত প্রবণ

  • মুভিং গড়ের প্রকৃতি বিলম্বিত, বাঁক পয়েন্ট মিস করতে পারে

  • স্থির পরামিতিগুলি বাজারের পরিবর্তনের সাথে মানিয়ে নিতে পারে না, অপ্টিমাইজেশান প্রয়োজন

  • স্টপ লস খুব নরম হতে পারে, সময়মতো স্টপ লস করতে অক্ষম

  • ঘন ঘন সংকেতগুলি উচ্চতর ট্রেডিং খরচ হতে পারে

  • সংকেতগুলি ভিন্ন হতে পারে এবং অন্যান্য সূচকগুলির সাথে নিশ্চিতকরণের প্রয়োজন

প্যারামিটার অপ্টিমাইজেশান, ফিল্টার যোগ করা, স্টপ লস শিথিল করা, সময়মত প্যারামিটার আপডেট করা ইত্যাদির মাধ্যমে ঝুঁকিগুলি পরিচালনা করা যেতে পারে।

উন্নতকরণ

  • বাজারের অবস্থার সাথে আরও ভালভাবে খাপ খাইয়ে নেওয়ার জন্য পরামিতিগুলি পরীক্ষা করুন এবং অপ্টিমাইজ করুন

  • একটি শক্তিশালী সিস্টেম গঠনের জন্য আরও সূচক প্রবর্তন করুন

  • রিয়েল-টাইম মার্কেটের উপর ভিত্তি করে অভিযোজিত পরামিতি সেটিংস তৈরি করুন

  • স্মার্ট অপ্টিমাইজেশনের জন্য মেশিন লার্নিং মডেল প্রয়োগ করুন

  • ঝুঁকি নিয়ন্ত্রণের জন্য গতিশীল বা ট্রেলিং স্টপ লস সেট করুন

  • বিভেদ এড়াতে ভলিউম সূচক একত্রিত করুন

সিদ্ধান্ত

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


/*backtest
start: 2023-01-01 00:00:00
end: 2023-02-03 00:00:00
period: 1d
basePeriod: 1h
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/
// © ehaarjee, ECHKAY, JackBauer007

//@version=4
//study(title="Tale_indicators", overlay=true)
strategy("Tale Indicators Strategy", overlay=true, precision=8, max_bars_back=200, pyramiding=0, initial_capital=20000, commission_type="percent", commission_value=0.1)

len_fast = input(3, minval=1, title="FAST EMA")
src_fast = input(close, title="Source for Fast")
fastMA = ema(src_fast, len_fast)
plot(fastMA, title="Slow EMA", color=color.orange)

len_slow = input(15, minval=1, title="SLOW EMA")
src_slow = input(close, title="Source for Slow")
slowMA = ema(src_slow, len_slow)
plot(slowMA, title="Fast EMA", color=color.blue)

len_fast_exit = input(3, minval=1, title="FAST EMA Exit")
src_fast_exit = input(close, title="Source for Fast Exit")
fastMAE = ema(src_fast_exit, len_fast_exit)
plot(fastMAE, title="Fast EMA Ex", color=color.red)


src_slow_enter_short = input(low, title="Source for Short Entry")
slowMASEn = ema(src_slow_enter_short, len_slow)

src_slow_enter_long = input(high, title="Source for Long Entry")
slowMALEn = ema(src_slow_enter_long, len_slow)

src_slow_exit_short = input(low, title="Source for Short Exit")
slowMASEx = ema(src_slow_enter_short, len_slow)

src_slow_exit_long = input(high, title="Source for Long Exit")
slowMALEx = ema(src_slow_enter_long, len_slow)

enter_long = crossover(fastMA, slowMALEn)
enter_short = crossunder(fastMA, slowMASEn)
exit_long = crossunder(fastMAE, slowMALEx)
exit_short = crossover(fastMAE, slowMALEx)

out_enter = iff(enter_long == true, 1, iff(enter_short == true, -1, 0))
plotarrow(out_enter, "Plot Enter Points", colorup=color.green, colordown=color.red, maxheight = 30)

bull = fastMA > slowMALEn
bear = fastMA < slowMASEn

c = bull ? color.green : bear ? color.red  : color.white
bgcolor(c)

exit_tuner = input(0.005, title="Exit Tuner to touch slowEMA")

bull_exit = (bull and (low>(fastMAE*(1+exit_tuner)))) or exit_long or (not(bear) and (fastMAE>high))
bear_exit = (bear and ((fastMAE*(1-exit_tuner))>high)) or exit_short or (not(bull) and (low>fastMAE))

bull_r = (bull and ((bull_exit[1]) or (bull_exit[2] and bull_exit[1])) and (low<=fastMAE))
bear_r = (bear and ((bear_exit[1]) or (bull_exit[2] and bull_exit[1])) and (fastMAE<=high))

bull_re = (bull and (low<slowMALEn)) and not(enter_long)
bear_re = (bear and (high>slowMASEn)) and not(enter_short)

bull_ree = (bull and ((low<slowMALEn) and not(bull_re[1] or enter_long[1]))) 
bear_ree = (bear and ((high>slowMASEn) and not(bear_re[1] or enter_short[1])))

bull_reenter =  (bull_r) and not(enter_long)
bear_reenter =  (bear_r) and not(enter_short)

plotshape(bull_exit, "Plot Bull Exit", style = shape.arrowdown, color=color.green, size=size.small, text="ExL", location=location.abovebar)
plotshape(bear_exit, "Plot Bear Exit", style = shape.arrowup, color=color.red, size=size.small, text="ExS", location=location.belowbar)

plotshape(bull_reenter, "Plot Bull ReEnter", style = shape.arrowup, color=color.green, size=size.small, text="ReL", location=location.belowbar)
plotshape(bear_reenter, "Plot Bear ReEnter", style = shape.arrowdown, color=color.red, size=size.small, text="ReS", location=location.abovebar)

run_strategy = input(true, title="Run Strategy")
// === INPUT BACKTEST RANGE ===
fromMonth = input(defval = 1,    title = "From Month",      type = input.integer, minval = 1, maxval = 12)
fromDay   = input(defval = 1,    title = "From Day",        type = input.integer, minval = 1, maxval = 31)
fromYear  = input(defval = 2020, title = "From Year",       type = input.integer, minval = 2000)
thruMonth = input(defval = 1,    title = "Thru Month",      type = input.integer, minval = 1, maxval = 12)
thruDay   = input(defval = 1,    title = "Thru Day",        type = input.integer, minval = 1, maxval = 31)
thruYear  = input(defval = 2100, title = "Thru Year",       type = input.integer, minval = 2000)

// === INPUT SHOW PLOT ===
showDate  = input(defval = true, title = "Show Date Range", type = input.bool)
// === FUNCTION EXAMPLE ===
start     = timestamp(fromYear, fromMonth, fromDay, 00, 00)        // backtest start window
finish    = timestamp(thruYear, thruMonth, thruDay, 23, 59)        // backtest finish window
window()  => true       // create function "within window of time"

var long_position_open = false
var short_position_open = false


if (enter_long and not(bull_exit) and not(long_position_open))
//    strategy.entry("LO", strategy.long, qty=4)
    long_position_open := true
    if (short_position_open)
//        strategy.close("SO")
        short_position_open := false

if (bull_reenter and not(long_position_open))  
//    strategy.entry("LO", strategy.long, qty=1)
    long_position_open := true

if (bull_exit and long_position_open)
//  strategy.close("LO")
    long_position_open := false
    
if (enter_short and not(bear_exit) and not(short_position_open))
//    strategy.entry("SO", strategy.short, qty=4)
    short_position_open := true
    if(long_position_open)
//        strategy.close("LO")
        long_position_open := false

if (bear_reenter and not(short_position_open))  
//    strategy.entry("SO", strategy.long, qty=1)
    long_position_open := true

if (bear_exit and short_position_open)
//    strategy.close("SO")
    short_position_open := false

if(run_strategy)
    strategy.entry("LO", strategy.long, when=(window() and enter_long), qty=4)
    strategy.entry("LO", strategy.long, when=(window() and bull_reenter and not(long_position_open)), qty=1)
    strategy.close("LO", when=(window() and bull_exit and long_position_open))
    strategy.entry("SO", strategy.short, when=(window() and enter_short), qty=4)
    strategy.entry("SO", strategy.short, when=(window() and bear_reenter and not(short_position_open)), qty=1)
    strategy.close("SO", when=(window() and bear_exit and short_position_open))


আরো