মৌলিক পিনবার ট্রেডিং কৌশল

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

img

সারসংক্ষেপ

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

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

  1. দ্রুত (20-পরিয়ড) এবং ধীর (50-পরিয়ড) চলমান গড় গণনা করুন।

  2. ক্যান্ডেলস্টিকের উপর ভিত্তি করে উত্থান (বন্ধ> খোলা) এবং হ্রাস (বন্ধ < খোলা) পিনবারগুলি চিহ্নিত করুন।

  3. পিনবার উচ্চ/নিম্ন পূর্ববর্তী মোমবাতি উচ্চ/নিম্ন ভঙ্গ করে কিনা তা পরীক্ষা করুন। পূর্ববর্তী উচ্চ ভঙ্গ একটি উত্থান পিনবার একটি দীর্ঘ সংকেত দেয়। পূর্ববর্তী নিম্ন ভঙ্গ একটি bearish পিনবার একটি সংক্ষিপ্ত সংকেত দেয়।

  4. এছাড়াও পরীক্ষা করুন যে দ্রুত এমএ ধীর এমএ এর উপরে একটি আপট্রেন্ড নির্ধারণ করতে, এবং বিপরীতভাবে একটি ডাউনট্রেন্ডের জন্য।

  5. দীর্ঘ সংকেত শুধুমাত্র বৈধ যখন দ্রুত / ধীর এমএ একটি আপট্রেন্ড নির্দেশ করে। সংক্ষিপ্ত সংকেত শুধুমাত্র বৈধ যখন দ্রুত / ধীর এমএ একটি ডাউনট্রেন্ড নির্দেশ করে। এটি পরিসীমা সীমাবদ্ধ মূল্য কর্মের সময় ভুল সংকেত এড়ায়।

  6. বৈধ লং সিগন্যালের ক্ষেত্রে, পূর্বনির্ধারিত স্টপ লস এবং টেকপ্রফিট দিয়ে লং যান। বৈধ শর্ট সিগন্যালের ক্ষেত্রে, পূর্বনির্ধারিত স্টপ লস এবং টেকপ্রফিট দিয়ে শর্ট যান।

  7. যদি দ্রুত এমএ ধীর এমএ এর নিচে অতিক্রম করে, তাহলে যেকোনো বিদ্যমান পজিশন বন্ধ করুন।

সুবিধা

  • শক্তিশালী গতির প্রতিনিধিত্বকারী ব্রেকআউট স্তর হিসাবে পিনবার উচ্চ / নিম্ন ব্যবহার করে।

  • প্রবণতা দিক বিবেচনা করে পরিসীমা-সীমাবদ্ধ মূল্য কর্মের সময় ভুল সংকেত এড়াতে, নির্ভুলতা উন্নত করে।

  • ট্রেন্ড এবং ব্রেকআউট ক্যাপচার করে, ট্রেন্ডিং মার্কেটে ভাল পারফর্ম করে।

  • প্যারামিটারগুলি বিভিন্ন পণ্য এবং সময়সীমার জন্য অনুকূলিত করা যেতে পারে।

ঝুঁকি এবং হ্রাস

  • পরাজিত পরাজয়ের ঝুঁকি, যা আরও বড় পরাজয়ের মাত্রা এবং শক্তিশালী গতি ব্যবহার করে হ্রাস করা যেতে পারে।

  • ভুল প্রবণতা সনাক্তকরণের ঝুঁকি। এমএ পরামিতিগুলি সংশোধন করে বা অন্যান্য প্রবণতা সূচক যুক্ত করে হ্রাস করা যেতে পারে।

  • স্টপলস খুব সংকীর্ণ যা অকাল প্রস্থান করে। পণ্য এবং সময়সীমার উপর ভিত্তি করে গতিশীলভাবে স্টপলস সামঞ্জস্য করতে পারে।

  • লাভের লক্ষ্যমাত্রা এবং ঝুঁকি-প্রতিদান অনুপাতগুলি গতিশীলভাবে নির্ধারণ করতে পারে।

উন্নতির সুযোগ

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

  • ইএমএ, এসএমএ ইত্যাদির মতো বিভিন্ন এমএ পরীক্ষা করা যেতে পারে যাতে সর্বোত্তম সূচকটি পাওয়া যায়।

  • ইম্পোমেন্টমের মতো অতিরিক্ত সূচকগুলি প্রবণতার নির্ভুলতা উন্নত করতে পারে।

  • মেশিন লার্নিং কৌশল ব্যবহার করে প্যারামিটারগুলি গতিশীলভাবে অনুকূলিত করা যেতে পারে।

  • পরিসংখ্যানগত শেখার মাধ্যমে ব্রেকআউট সাফল্যের হার উন্নত করা যায়।

সংক্ষিপ্তসার

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


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

//@version=4
//Backtested Time Frame: H1
//Default Settings: Are meant to run successfully on all currency pairs to reduce over-fitting.
//Risk Warning: This is a forex trading robot, backtest performance will not equal future performance, USE AT YOUR OWN RISK.
//Code Warning: Although every effort has been made for robustness, this code has not been vetted by independent 3rd parties.
strategy("Pin Bar Strategy v1", overlay=true)

// User Input
usr_risk = input(title="Equity Risk (%)",type=input.integer,minval=1,maxval=100,step=1,defval=3,confirm=false)
atr_mult = input(title="Stop Loss (x*ATR, Float)",type=input.float,minval=0.1,maxval=100,step=0.1,defval=1.9,confirm=false)
trd_rewd = input(title="Risk : Reward (1 : x*SL, Float)",type=input.float,minval=0.1,maxval=100,step=0.1,defval=3.1,confirm=false)
sma_fast = input(title="Fast MA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=20,confirm=false)
sma_slow = input(title="Slow MA (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=50,confirm=false)
atr_valu = input(title="ATR (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=14,confirm=false)
use_slpe = input(title="Use MA Slope (Boolean)",type=input.bool,defval=true,confirm=false)
slp_long = input(title="Bull Slope Angle (Deg)",type=input.integer,minval=-90,maxval=90,step=1,defval=1,confirm=false)
slp_shrt = input(title="Bear Slope Angle (Deg)",type=input.integer,minval=-90,maxval=90,step=1,defval=-1,confirm=false)
emg_exit = input(title="Exit When MA Re-Cross (Boolean)",type=input.bool,defval=true,confirm=false)
ent_canc = input(title="Cancel Entry After X Bars (Period)",type=input.integer,minval=1,maxval=500,step=1,defval=3,confirm=false)

// Create Indicators
fastSMA = sma(close, sma_fast)
slowSMA = sma(close, sma_slow)
bullishPinBar = ((close > open) and ((open - low) > 0.66 * (high - low))) or ((close < open) and ((close - low) > 0.66 * (high - low)))
bearishPinBar = ((close > open) and ((high - close) > 0.66 * (high - low))) or ((close < open) and ((high - open) > 0.66 * (high - low)))
atr = atr(atr_valu)

// Specify Trend Conditions
smaUpTrend = (fastSMA > slowSMA) and (fastSMA[1] > slowSMA[1]) and (fastSMA[2] > slowSMA[2]) and (fastSMA[3] > slowSMA[3]) and (fastSMA[4] > slowSMA[4])
smaDnTrend = (fastSMA < slowSMA) and (fastSMA[1] < slowSMA[1]) and (fastSMA[2] < slowSMA[2]) and (fastSMA[3] < slowSMA[3]) and (fastSMA[4] < slowSMA[4])
candleUpTrend = (close[5] > fastSMA[5]) and (open[5] > fastSMA[5]) and (close[6] > fastSMA[6]) and (open[6] > fastSMA[6]) and (close[7] > fastSMA[7]) and (open[7] > fastSMA[7]) and (close[8] > fastSMA[8]) and (open[8] > fastSMA[8]) and (close[9] > fastSMA[9]) and (open[9] > fastSMA[9]) and (close[10] > fastSMA[10]) and (open[10] > fastSMA[10])
candleDnTrend = (close[5] < fastSMA[5]) and (open[5] < fastSMA[5]) and (close[6] < fastSMA[6]) and (open[6] < fastSMA[6]) and (close[7] < fastSMA[7]) and (open[7] < fastSMA[7]) and (close[8] < fastSMA[8]) and (open[8] < fastSMA[8]) and (close[9] < fastSMA[9]) and (open[9] < fastSMA[9]) and (close[10] < fastSMA[10]) and (open[10] < fastSMA[10])

// Specify Piercing Conditions
bullPierce = ((low < fastSMA) and (open > fastSMA) and (close > fastSMA)) or ((low < slowSMA) and (open > slowSMA) and (close > slowSMA))
bearPierce = ((high > fastSMA) and (open < fastSMA) and (close < fastSMA)) or ((high > slowSMA) and (open < slowSMA) and (close < slowSMA))

// MA Slope Function
angle(_source) =>
    rad2degree=180/3.14159265359
    ang=rad2degree*atan((_source[0] - _source[1])/atr(atr_valu)) 

// Calculate MA Slope
fastSlope=angle(fastSMA)
slowSlope=angle(slowSMA)
slopingUp = fastSlope > slp_long
slopingDn = fastSlope < slp_shrt
    
// Specify Entry Conditions
longEntry = smaUpTrend and bullishPinBar and bullPierce
shortEntry = smaDnTrend and bearishPinBar and bearPierce
longEntryWithSlope = smaUpTrend and bullishPinBar and bullPierce and slopingUp
shortEntryWithSlope = smaDnTrend and bearishPinBar and bearPierce and slopingDn

// Specify Secondary Exit Conditions
longExit = crossunder(fastSMA, slowSMA)
shortExit = crossover(fastSMA, slowSMA)

// Long Entry Function
enterlong() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = low[1] - atr[1] * atr_mult
    entryPrice = high[1]
    units = risk / (entryPrice - stopLoss)
    takeProfit = entryPrice + trd_rewd * (entryPrice - stopLoss)
    strategy.entry("long", strategy.long, units, stop=entryPrice)
    strategy.exit("exit long", "long", stop=stopLoss, limit=takeProfit)
    
// Short Entry Function
entershort() =>
    risk = usr_risk * 0.01 * strategy.equity
    stopLoss = high[1] + atr[1] * atr_mult
    entryPrice = low[1]
    units = risk / (stopLoss - entryPrice)
    takeProfit = entryPrice - trd_rewd * (stopLoss - entryPrice)
    strategy.entry("short", strategy.short, units, stop=entryPrice)
    strategy.exit("exit short", "short", stop=stopLoss, limit=takeProfit)
    
// Execute Long Entry w/o Slope
if (longEntry and use_slpe == false)
    enterlong()
    
// Execute Long Entry w/ Slope
if (longEntryWithSlope and use_slpe == true)
    enterlong()

// Exit Long Due to Re-Cross
if(longExit and strategy.position_size > 0 and emg_exit)    
    strategy.order("exit long, re-cross", strategy.short, abs(strategy.position_size))

// Cancel the Long Entry
strategy.cancel("long", barssince(longEntry) > ent_canc)

// Execute Short Entry w/o Slope
if (shortEntry and use_slpe == false)
    entershort() 
    
// Execute Short Entry w/ Slope
if (shortEntryWithSlope and use_slpe == true)
    entershort() 

// Exit Short Due to Re-Cross
if(shortExit and strategy.position_size < 0 and emg_exit)    
    strategy.order("exit short, re-cross", strategy.long, abs(strategy.position_size))

// Cancel the Short Entry
strategy.cancel("short", barssince(shortEntry) > ent_canc)

// Plot Moving Averages to Chart
plot(fastSMA, color=color.red)
plot(slowSMA, color=color.blue)

// Plot Pin Bars to Chart
plotshape(bullishPinBar, style=shape.arrowup, location=location.abovebar, color=#FF0000, text='')
plotshape(bearishPinBar, style=shape.arrowdown, location=location.belowbar, color=#0000FF, text='')

আরো