মেশিন লার্নিং এর উপর ভিত্তি করে স্টোকাস্টিক অপ্টিমাইজেশান সহ মূল্য EMA

লেখক:চাওঝাং, তারিখঃ 2024-01-26 14:57:08
ট্যাগঃ

img

সারসংক্ষেপ

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

কৌশল নীতি

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

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

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

কৌশলটির সুবিধা

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

এজন্য এই কৌশলটি প্রবণতাকে নির্বাচনীভাবে অনুসরণ করতে পারে যাতে সুযোগগুলি কাজে লাগানো যায় এবং উচ্চতর মুনাফা অর্জন করা যায়।

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

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

এই ঝুঁকি কমাতে, আমরা স্টপ লস সেট করতে পারি, অথবা আরো মাঝারি এমএ পরামিতি গ্রহণ করতে পারি।

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

কৌশলটি নিম্নলিখিত দিকগুলি থেকে আরও অনুকূলিত করা যেতে পারেঃ

  1. সর্বোত্তম খুঁজে পেতে এমএ পরামিতি বিভিন্ন সমন্বয় পরীক্ষা
  2. স্টোকাস্টিক পরামিতির বিভিন্ন সমন্বয় পরীক্ষা করুন
  3. স্টপ লস কৌশল যোগ করুন
  4. অস্থিরতার উপর ভিত্তি করে গতিশীল স্টপ লস যোগ করুন
  5. বিভিন্ন পণ্য এবং সময়সীমার মধ্যে পরীক্ষার পরামিতি অপ্টিমাইজেশান
  6. প্যারামিটার অপ্টিমাইজ করার জন্য মেশিন লার্নিং অ্যালগরিদম ব্যবহার করুন

বিভিন্ন প্যারামিটার সমন্বয় পরীক্ষা করে, আরও ভাল প্যারামিটার পাওয়া যেতে পারে। এছাড়াও, স্টপ লস কৌশলগুলি কার্যকরভাবে ঝুঁকি হ্রাস করতে এবং স্থিতিশীলতা বাড়াতে পারে।

সিদ্ধান্ত

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


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

//@version=4
// author SoftKill

strategy(title="Price EMA with stock", shorttitle="EMA STOCH", overlay=true)
src = input(title="Source", type=input.source, defval=close)

src_0 = src[0]
src_1 = src[1]
src_2 = src[2]
src_3 = src[3]
src_4 = src[4]

len50 = input(50, minval=1, title="Length")
src50 = input(close, title="Source")
out50 = ema(src50, len50)
len100 = input(100)
src100 = input(close, title="Source")
out100 = ema(src100, len100)

len1 = input(1, minval=1, title="Length")
src1 = input(close, title="Source")
out1 = sma(src1, len1)

length = input(5, minval=1)
OverBought = input(80)
OverSold = input(20)
smoothK = 3
smoothD = 3

k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)
cu = crossover(k,OverSold)
co = crossunder(k,OverBought)

sma_down = crossunder(out1, out50)
sma_up = crossover(out1,out50)

//if (not na(k) and not na(d))
  //  if (co and k < OverSold)
    //    strategy.entry("StochLE", strategy.long, comment="StochLE")
    //if (cu and k > OverBought)
     //   strategy.entry("StochSE", strategy.short, comment="StochSE")

crossCandle_4 = crossover(src[4],out50)
crossCandleUnder_4= cross(src[4],out50)
crossCandle_3 = crossover(src[3],out50)
crossCandleUnder_3= crossunder(src[3],out50)
crossCandle_2 = crossover(src[2],out50)
crossCandleUnder_2= crossunder(src[2],out50)
crossCandle_1 = crossover(src[1],out50)
crossCandleUnder_1= crossunder(src[1],out50)
crossCandle_0 = crossover(src[0],out50)
crossCandleUnder_0= crossunder(src[0],out50)

conditionOver = (crossCandle_4 or crossCandle_3 or crossCandle_2 or crossCandle_1 or crossCandle_0)
conditionUnder =(crossCandleUnder_4 or crossCandleUnder_3 or crossCandleUnder_2 or crossCandleUnder_1 or crossCandleUnder_0)

touch4 = (cross(low[4],out50) or cross(high[4],out50))
touch3 = (cross(low[3],out50) or cross(high[3],out50))
touch2 = (cross(low[2],out50) or cross(high[2],out50))
touch1 = (cross(low[1],out50) or cross(high[1],out50))

touch = touch1 or touch2 or touch3 or touch4

//and sma_up
//and sma_down

// Getting inputs
fast_length = input(title="Fast Length", type=input.integer, defval=12)
slow_length = input(title="Slow Length", type=input.integer, defval=26)
src_macd = input(title="Source", type=input.source, defval=close)
signal_length = input(title="Signal Smoothing", type=input.integer, minval = 1, maxval = 50, defval = 9)
sma_source = input(title="Simple MA(Oscillator)", type=input.bool, defval=false)
sma_signal = input(title="Simple MA(Signal Line)", type=input.bool, defval=false)

// Plot colors
col_grow_above = #26A69A
col_grow_below = #FFCDD2
col_fall_above = #B2DFDB
col_fall_below = #EF5350
col_macd = #0094ff
col_signal = #ff6a00

// Calculating
fast_ma = sma_source ? sma(src_macd, fast_length) : ema(src_macd, fast_length)
slow_ma = sma_source ? sma(src_macd, slow_length) : ema(src_macd, slow_length)
macd = fast_ma - slow_ma
signal = sma_signal ? sma(macd, signal_length) : ema(macd, signal_length)
hist = macd - signal

//plot(hist, title="Histogram", style=plot.style_columns, color=(hist>=0 ? (hist[1] < hist ? col_grow_above : col_fall_above) : (hist[1] < hist ? col_grow_below : col_fall_below) ), transp=0 )
//plot(macd, title="MACD", color=col_macd, transp=0)
//plot(signal, title="Signal", color=col_signal, transp=0)


// plot((conditionOver or conditionUnder or touch)  and src[0] >= out50 and close >= out50 and  (cu) and out50 > out100 and hist>=0 , title="Buy", style=plot.style_columns, color=color.lime)
// plot((conditionOver or conditionUnder or touch)  and src[0] <= out50 and close <= out50 and  (co) and out50< out100 and hist<=0 , title="sell", style=plot.style_columns, color=color.red)


long_cond = ((conditionOver or conditionUnder or touch)  and src[0] >= out50 and close > out50 and  (cu) and out50 > out100 and hist>=0)
short_cond = ((conditionOver or conditionUnder or touch)  and src[0] <= out50 and close < out50 and  (co) and out50< out100 and hist<=0)

tp=input(0.1)
sl=input(0.1)

strategy.entry("long",strategy.long, when=long_cond)
strategy.entry("short",strategy.short, when=short_cond)

strategy.exit("X_long", "long", profit=close * tp / syminfo.mintick,  loss=close * sl / syminfo.mintick, when=touch  )
strategy.exit("x_short", "short",profit=close * tp / syminfo.mintick,loss=close * sl / syminfo.mintick,when = touch )

// //tp = input(0.0003, title="tp")
// tp = 0.0003
// //sl = input(1.0 , title="sl")
// sl = 1.0
// strategy.exit("closelong", "long" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closelong")
// strategy.exit("closeshort", "short" , profit = close * tp / syminfo.mintick, loss = close * sl / syminfo.mintick, alert_message = "closeshort")

আরো