ডাবল মুভিং এভারেজ ক্রসওভার কৌশল

লেখক:চাওঝাং, তারিখঃ 2024-01-12 14:59:18
ট্যাগঃ

img

সারসংক্ষেপ

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

নীতিমালা

এই কৌশলটির মূল সূচক দুটি ইএমএ লাইন, একটি 30 পিরিয়ড এবং অন্যটি 60 পিরিয়ড। দুটি ইএমএ লাইন কোডের কাস্টম ফাংশন দ্বারা গণনা করা হয়ঃ

emaLen1 = emaFuncOne(close, lenMA1)
emaLen2 = emaFuncTwo(close, lenMA2)  

ট্রেডিং সিগন্যাল দুটি EMA লাইনের ক্রসিং থেকে উৎপন্ন হয়ঃ

currentState = if emaLen2 > emaLen1
    0
else 
    1

previousState = if emaLastLen2 > emaLastLen1 
    0
else
    1

convergence = if currentState != previousState
    1  
else
    0

যখন সংক্ষিপ্ত সময়ের EMA দীর্ঘ সময়ের EMA অতিক্রম করে, currentState পূর্ববর্তীState সমান নয়, একটি ক্রসওভার সংকেত সক্রিয় করা হয়, দীর্ঘ যান। যখন সংক্ষিপ্ত সময়ের EMA দীর্ঘ সময়ের EMA এর নিচে অতিক্রম করে, currentState পূর্ববর্তীState এর সমান নয়, একটি ক্রসওভার সংকেত সক্রিয় করা হয়, শর্ট যান।

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

এই কৌশলটির সুবিধাগুলো হল:

  1. যুক্তি সহজ এবং স্বজ্ঞাত, বুঝতে এবং বাস্তবায়ন করা সহজ
  2. EMA এর সাথে দামের ওঠানামা মসৃণ করে এবং বাজারের গোলমাল ফিল্টার করে
  3. স্বয়ংক্রিয়ভাবে প্রবণতা অনুসরণ করে, মিস ট্রেড এড়ায়

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

এই কৌশলটির সাথে কিছু ঝুঁকিও রয়েছেঃ

  1. ক্রসওভার সিগন্যালগুলি বিলম্বিত হতে পারে এবং সময়মতো বিপরীততা ধরতে ব্যর্থ হতে পারে
  2. Whipsaw সংকেত প্রায়ই ব্যাপ্তি বাজারের সময় ঘটতে পারে
  3. খারাপ প্যারামিটার টিউনিং অতিরিক্ত সংবেদনশীলতা বা বিলম্ব হতে পারে

EMA সময়কাল সামঞ্জস্য বা ফিল্টার যোগ করে অপ্টিমাইজেশন করা যেতে পারে।

অপ্টিমাইজেশান নির্দেশাবলী

এই কৌশল নিম্নলিখিত দিক থেকে অপ্টিমাইজ করা যেতে পারেঃ

  1. বিভিন্ন EMA সময়কালের সমন্বয় পরীক্ষা করুন
  2. মিথ্যা সংকেত হ্রাস করার জন্য ভলিউম বা অস্থিরতা ফিল্টার যুক্ত করুন
  3. প্রবণতা নিশ্চিত করার জন্য MACD এর মতো অন্যান্য সূচক অন্তর্ভুক্ত করুন
  4. স্টপ লস এবং লাভের সাথে অর্থ পরিচালনা অনুকূল করুন

সিদ্ধান্ত

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


/*backtest
start: 2024-01-10 00:00:00
end: 2024-01-11 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
strategy("ParkerMAStrat", overlay=true)

lenMA1=input(title="Length 1", defval=30)
lenMA2=input(title="Length 2",  defval=60)

x = 0

checkLines(current, last) =>

    if current > last
        x = 1
    else
        x = 0
    x
    

//plot ema based on len1
emaFuncOne(src, time_period) =>

    alpha = 2 / (time_period + 1)
    // we have defined the alpha function above
    ema = 0.0
    // this is the initial declaration of ema, since we dont know the first ema we will declare it to 0.0 [as a decimal]
    ema := alpha * src + (1 - alpha) * nz(ema[1])
    // this returns the computed ema at the current time
    // notice the use of : (colon) symbol before =, it symbolises, that we are changing the value of ema,
    // since the ema was previously declared to 0
    // this is called mutable variale declaration in pine script
    ema
    // return ema from the function

emaLen1 = emaFuncOne(close, lenMA1)

    
plot(emaLen1, color=green, transp=0, linewidth=2)
// now we plot the _10_period_ema

//plot ema based on len2
emaFuncTwo(src, time_period) =>

    alpha = 2 / (time_period + 1)
    // we have defined the alpha function above
    ema = 0.0
    // this is the initial declaration of ema, since we dont know the first ema we will declare it to 0.0 [as a decimal]
    ema := alpha * src + (1 - alpha) * nz(ema[1])
    // this returns the computed ema at the current time
    // notice the use of : (colon) symbol before =, it symbolises, that we are changing the value of ema,
    // since the ema was previously declared to 0
    // this is called mutable variale declaration in pine script
    ema
    // return ema from the function

//plot ema based on len2
emaFuncOneLast(src, time_period) =>

    alpha = 2 / (time_period + 1)
    // we have defined the alpha function above
    ema = 0.0
    // this is the initial declaration of ema, since we dont know the first ema we will declare it to 0.0 [as a decimal]
    ema := alpha * src + (1 - alpha) * nz(ema[0])
    // this returns the computed ema at the current time
    // notice the use of : (colon) symbol before =, it symbolises, that we are changing the value of ema,
    // since the ema was previously declared to 0
    // this is called mutable variale declaration in pine script
    ema
    // return ema from the function

//plot ema based on len2
emaFuncTwoLast(src, time_period) =>

    alpha = 2 / (time_period + 1)
    // we have defined the alpha function above
    ema = 0.0
    // this is the initial declaration of ema, since we dont know the first ema we will declare it to 0.0 [as a decimal]
    ema := alpha * src + (1 - alpha) * nz(ema[0])
    // this returns the computed ema at the current time
    // notice the use of : (colon) symbol before =, it symbolises, that we are changing the value of ema,
    // since the ema was previously declared to 0
    // this is called mutable variale declaration in pine script
    ema
    // return ema from the function



emaLastLen1 = emaFuncOneLast(close, lenMA1)
emaLastLen2 = emaFuncTwoLast(close, lenMA2)
emaLen2 = emaFuncTwo(close, lenMA2)

    
plot(emaLen2, color=red, transp=30, linewidth=2)
// now we plot the _10_period_ema

//now we compare the two and when green crosses red we buy/sell (line1 vs line2)

previousState = if emaLastLen2 > emaLastLen1
    0
else
    1

currentState = if emaLen2 > emaLen1
    0
else
    1

convergence = if currentState != previousState
    1
else
    0

    
lineCheck = if convergence == 1 
    checkLines(currentState, previousState)
    
if lineCheck == 1
    strategy.entry("Long", strategy.long)
else
    strategy.entry("Short", strategy.short)


আরো