পরিমাণগত গতির ট্রেডিং কৌশল

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

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

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

মূল মূল্যায়ন সূচকগুলির মধ্যে রয়েছেঃ

  1. বিভিন্ন সময়ের মধ্যে প্রবণতা পরিমাপ করার জন্য EMAs।

  2. MACD স্বল্পমেয়াদী গতির পরিবর্তন সনাক্ত করতে।

  3. অতিরিক্ত ক্রয়/অতিরিক্ত বিক্রয়ের মাত্রা পরীক্ষা করার জন্য RSI।

  4. স্টপ লস এবং লাভের হিসাবের জন্য ATR।

এটি এই সূচকগুলোকে একত্রিত করে স্থায়ী, শক্তিশালী ব্রেকআউট চিহ্নিত করে যা বাণিজ্যে প্রবেশের প্রবণতার সূচনাকে নির্দেশ করে।

যখন স্বল্পমেয়াদী ইএমএ প্রায়শই ওঠানামা করে, তখন এটি বাজারকে ব্যাপ্তি হিসাবে বিচার করে। দীর্ঘমেয়াদী ইএমএ ভেঙে গেলে কেবল ট্রেড করা হয়।

এমএসিডি গতির শক্তি বিচার করে, আরএসআই শীর্ষ এবং নীচে তাড়া এড়ায়। এটিআর প্রতি বাণিজ্যে স্টপ লস সেট করে এবং মুনাফা গ্রহণ করে ঝুঁকি নিয়ন্ত্রণ করে।

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

সবচেয়ে বড় সুবিধা হল সূচকগুলির পরিপূরকতা, যা কার্যকরভাবে মাঝারি ও দীর্ঘমেয়াদী প্রবণতার সূচনা সনাক্ত করতে পারে।

আরেকটি সুবিধা হ'ল স্টপ লস এবং লাভ গ্রহণ, যা ট্রেন্ড মুনাফা লক করে এবং ঝুঁকি পরিচালনা করে।

অবশেষে, ধাপে ধাপে EMA সময়গুলি বিভিন্ন গতি স্তরে মসৃণ প্রবণতা প্রবেশের অনুমতি দেয়।

III. সম্ভাব্য ঝুঁকি

তবে, এই কৌশলটি নিম্নলিখিত ঝুঁকিগুলিও বহন করেঃ

প্রথমত, প্রবণতা সনাক্তকরণ বিলম্বিত হতে পারে, যার ফলে সুযোগ হারাতে পারে।

দ্বিতীয়ত, খুব সংকীর্ণভাবে থামার ঝুঁকি রয়েছে যে এটি অকাল বন্ধ হয়ে যাবে।

অবশেষে, হ্রাসের চাপের জন্য মানসিক প্রস্তুতির প্রয়োজন।

IV. সংক্ষিপ্ত বিবরণ

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


/*backtest
start: 2023-08-14 00:00:00
end: 2023-08-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("QuantCat Mom Finder Strateg (1H)", overlay=true)

//Series to sum the amount of crosses in EMA for sideways trend/noise filtering
//can change EMA lengths, can change to SMA's/WMA's e.t.c

lookback_value = 60
minMA = 20
midMA = 40
maxMA = 60

ema25_crossover = (crossover(close, ema(close, minMA))) == true ? 1 : 0
ema25_crossover_sum = sum(ema25_crossover, lookback_value) ///potentially change lookback value to alter results

ema50_crossover = (crossover(close, ema(close, midMA))) == true ? 1 : 0
ema50_crossover_sum = sum(ema50_crossover, lookback_value) ///potentially change lookback value to alter results

ema75_crossover = (crossover(close, ema(close, maxMA))) == true ? 1 : 0
ema75_crossover_sum = sum(ema75_crossover, lookback_value) ///potentially change lookback value to alter results

ema25_crossunder = (crossunder(close, ema(close, minMA))) == true ? 1 : 0
ema25_crossunder_sum = sum(ema25_crossunder, lookback_value) ///potentially change lookback value to alter results

ema50_crossunder = (crossunder(close, ema(close, midMA))) == true ? 1 : 0
ema50_crossunder_sum = sum(ema50_crossunder, lookback_value) ///potentially change lookback value to alter results

ema75_crossunder = (crossunder(close, ema(close, maxMA))) == true ? 1 : 0
ema75_crossunder_sum = sum(ema75_crossunder, lookback_value) ///potentially change lookback value to alter results4


//Boolean series declaration
//can change amount of times crossed over the EMA verification to stop sideways trend filtering (3)

maxNoCross=2

macdmidlinebull=-0.5
macdmidlinebear=0.5
[macdLine, signalLine, histLine] = macd(close, 12, 26, 9)

//---------------
//Series Creation

bullishMacd = (macdLine > signalLine) and (macdLine > macdmidlinebull) ? true : false

bearishMacd = (macdLine < signalLine) and (macdLine < macdmidlinebear) ? true : false

bullRsiMin = 50 //53 initial values
bullRsiMax = 60 //61
bearRsiMin = 40 //39
bearRsiMax = 50 //47

basicBullCross25bool = ((ema25_crossover_sum < ema50_crossover_sum) 
     and (ema25_crossover_sum < ema75_crossover_sum) 
     and (ema25_crossover_sum < maxNoCross) 
     and crossover(close, ema(close, minMA)) and (rsi(close, 14) > bullRsiMin)
     and (rsi(close, 14) < bullRsiMax) and (bullishMacd == true)) ? true : false
  
basicBullCross50bool = ((ema50_crossover_sum < ema25_crossover_sum) 
     and (ema50_crossover_sum < ema75_crossover_sum) 
     and (ema50_crossover_sum < maxNoCross) 
     and crossover(close, ema(close, midMA)) and (rsi(close, 14) > bullRsiMin)
     and (basicBullCross25bool == false) 
     and (rsi(close, 14) < bullRsiMax) and (bullishMacd == true)) ? true : false
  
basicBullCross75bool = ((ema75_crossover_sum < ema25_crossover_sum) 
     and (ema75_crossover_sum < ema50_crossover_sum) 
     and (ema75_crossover_sum < maxNoCross) 
     and crossover(close, ema(close, maxMA)) and (rsi(close, 14) > bullRsiMin)
     and (basicBullCross25bool == false) and (basicBullCross50bool == false)
     and (rsi(close, 14) < bullRsiMax) and (bullishMacd == true)) ? true : false
     
basicBearCross25bool = ((ema25_crossunder_sum < ema50_crossunder_sum) 
     and (ema25_crossunder_sum < ema75_crossunder_sum) 
     and (ema25_crossunder_sum < maxNoCross) 
     and crossunder(close, ema(close, minMA)) and (rsi(close, 14) <bearRsiMax)
     and (rsi(close, 14) > bearRsiMin) and (bearishMacd == true)) ? true : false
  
basicBearCross50bool = ((ema50_crossunder_sum < ema25_crossunder_sum) 
     and (ema50_crossunder_sum < ema75_crossover_sum) 
     and (ema50_crossunder_sum < maxNoCross) 
     and crossunder(close, ema(close, midMA)) and (rsi(close, 14) < bearRsiMax)
     and (basicBearCross25bool == false) 
     and (rsi(close, 14) > bearRsiMin) and (bearishMacd == true)) ? true : false
  
basicBearCross75bool = ((ema75_crossunder_sum < ema25_crossunder_sum) 
     and (ema75_crossunder_sum < ema50_crossunder_sum) 
     and (ema75_crossunder_sum < maxNoCross) 
     and crossunder(close, ema(close, maxMA)) and (rsi(close, 14) < bearRsiMax)
     and (basicBearCross25bool == false) and (basicBearCross50bool == false)
     and (rsi(close, 14) > bearRsiMin) and (bearishMacd == true)) ? true : false

//STRATEGY
//can change lookback input on ATR

atrLkb = input(14, minval=1, title='ATR Stop Period')
atrRes = input("D",  title='ATR Resolution')
atr = security(syminfo.tickerid, atrRes, atr(atrLkb))


longCondition = (basicBullCross25bool or basicBullCross50bool or basicBullCross75bool) == true
if (longCondition)
    strategy.entry("Long", strategy.long)

shortCondition = (basicBearCross25bool or basicBearCross50bool or basicBearCross75bool) == true
if (shortCondition)
    strategy.entry("Short", strategy.short)
    
   
// Calc ATR Stops
// can change atr multiplier to affect stop distance/tp distance, and change "close" to ema values- could try ema 50

stopMult = 0.6 //0.6 is optimal

longStop = na
longStop :=  shortCondition ? na : longCondition and strategy.position_size <=0 ? close - (atr * stopMult) : longStop[1] 
shortStop = na
shortStop := longCondition ? na : shortCondition and strategy.position_size >=0 ? close + (atr * stopMult) : shortStop[1]

//Calc ATR Target

targetMult = 2.2 //2.2 is optimal for crypto x/btc pairs

longTarget = na
longTarget :=  shortCondition ? na : longCondition and strategy.position_size <=0 ? close + (atr*targetMult) : longTarget[1]
shortTarget = na
shortTarget := longCondition ? na : shortCondition and strategy.position_size >=0 ? close - (atr*targetMult) : shortTarget[1]

// Place the exits

strategy.exit("Long ATR Stop", "Long", stop=longStop, limit=longTarget)
strategy.exit("Short ATR Stop", "Short", stop=shortStop, limit=shortTarget)

//Bar color series

longColour = longCondition ? lime : na
shortColour = shortCondition ? red : na
    
// Plot the stoplosses and targets

plot(longStop, style=linebr, color=red, linewidth=2,     title='Long ATR Stop')
plot(shortStop, style=linebr, color=red, linewidth=2,  title='Short ATR Stop')
plot(longTarget, style=linebr, linewidth=2, color=lime,  title='Long ATR Target')
plot(shortTarget, linewidth=2, style=linebr, color=lime,  title='Long ATR Target')

barcolor(color=longColour)
barcolor(color=shortColour)

alertcondition(((basicBullCross25bool or basicBullCross50bool or basicBullCross75bool)==true), title='Long Entry', message='Bullish Momentum Change!')
alertcondition(((basicBearCross25bool or basicBearCross50bool or basicBearCross75bool)==true), title='Short Entry', message='Bearish Momentum Change!')

আরো