
এই কৌশলটির মূল ধারণা হল দ্রুত চলমান গড় এবং ধীর চলমান গড়ের সংমিশ্রণ ব্যবহার করে বাজারের প্রবণতা নির্ধারণ করা এবং সংক্ষিপ্ত এবং দীর্ঘ লাইন গড়ের বিপরীত হওয়ার সময় প্রবেশ করা, ট্রেন্ড ট্র্যাকিংয়ের প্রভাব অর্জনের জন্য।
এই কৌশলটি সামগ্রিকভাবে যুক্তিযুক্ত এবং সহজেই বোঝা যায়, দ্রুত গড় এবং ধীর গড় রেখার বিপরীতের মাধ্যমে বাজারের প্রবণতা টার্নপয়েন্টগুলি নির্ধারণ করে, তাত্ত্বিকভাবে প্রবণতা কার্যকরভাবে অনুসরণ করতে পারে। তবে বাস্তবে প্রয়োগের জন্য কৌশল অ্যালগরিদম নিজেই এবং প্যারামিটার সেটিংয়ের জন্য অপ্টিমাইজ করা প্রয়োজন, যাতে এটি আরও স্থিতিশীল এবং বাস্তবসম্মত হয়।
/*backtest
start: 2022-11-15 00:00:00
end: 2023-11-21 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("Up Down", "Up Down", precision = 6, pyramiding = 1, default_qty_type = strategy.percent_of_equity, default_qty_value = 99, commission_type = strategy.commission.percent, commission_value = 0.0, initial_capital = 1000, overlay = true)
buy = close > open and open > close[1]
sell = close < open and open < close[1]
longma = input(77,"Long MA Input")
shortma = input(7,"Short MA Input")
long = sma(close,longma)
short = sma(close, shortma)
mabuy = crossover(short,long) or buy and short > long
masell = crossunder(short,long) or sell and short > long
num_bars_buy = barssince(mabuy)
num_bars_sell = barssince(masell)
//plot(num_bars_buy, color = teal)
//plot(num_bars_sell, color = orange)
xbuy = crossover(num_bars_sell, num_bars_buy)
xsell = crossunder(num_bars_sell, num_bars_buy)
plotshape(xbuy,"Buy Up Arrow", shape.triangleup, location.belowbar, white, size = size.tiny)
plotshape(xsell,"Sell Down Arrow", shape.triangledown, location.abovebar, white, size = size.tiny)
plot(long,"Long MA", fuchsia, 2)
// Component Code Start
// Example usage:
// if testPeriod()
// strategy.entry("LE", strategy.long)
testStartYear = input(2017, "Backtest Start Year")
testStartMonth = input(01, "Backtest Start Month")
testStartDay = input(2, "Backtest Start Day")
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = input(2019, "Backtest Stop Year")
testStopMonth = input(7, "Backtest Stop Month")
testStopDay = input(30, "Backtest Stop Day")
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)
// A switch to control background coloring of the test period
testPeriodBackground = input(title="Color Background?", type=bool, defval=true)
testPeriodBackgroundColor = testPeriodBackground and (time >= testPeriodStart) and (time <= testPeriodStop) ? #00FF00 : na
bgcolor(testPeriodBackgroundColor, transp=97)
testPeriod() => true
// Component Code Stop
if testPeriod()
strategy.entry("buy", true, when = xbuy, limit = close)
strategy.close("buy", when = xsell)