এই কৌশলটি ক্রিপ্টোকারেন্সি বাজারে শক্তিশালী প্রবণতা ক্যাপচার করার জন্য তৈরি করা হয়েছে, যা প্রবণতা তৈরির সংকেত সনাক্ত করতে মাল্টি-চ্যানেল এবং চলমান গড় ব্যবহার করে এবং প্রবণতা বাজারে মুনাফা অর্জনের জন্য স্ব-অনুকূলিত স্টপ লকের ব্যবহারের সাথে মিউচুয়াল ফিল্টারিং ফেক ব্রেকগুলিকে সংযুক্ত করে।
এই কৌশলটি প্রবণতা সনাক্ত করতে দ্রুত চ্যানেল, ধীর চ্যানেল এবং দ্রুত চলমান গড়ের সমন্বয় ব্যবহার করে। দ্রুত চ্যানেলের প্যারামিটারগুলি সংবেদনশীল, স্বল্পমেয়াদী মূল্যের ওঠানামা ধরার জন্য; ধীর চ্যানেলের প্যারামিটারগুলি ধীর, বড় প্রবণতা বিচার করার জন্য; দ্রুত চলমান গড় প্যারামিটারগুলি উভয়ের মধ্যে রয়েছে, যখন এটি চ্যানেলটি ভেঙে দেয় তখন লেনদেনের সংকেত দেয়।
নির্দিষ্টভাবে, এটি প্রথমে দ্রুত ট্র্যাকেলের উপরের এবং নীচের ট্র্যাক এবং চলমান গড় গণনা করে। যখন দামটি উঁচুতে উঠে যায়, তখন যদি ধীর ট্র্যাকেলের নীচের ট্র্যাকটিও চলমান গড়ের উপরে থাকে তবে এটি একটি মাল্টিসিগন্যাল উত্পন্ন করে। বিপরীতভাবে, ধীর ট্র্যাকেলের ট্র্যাকটি উঁচুতে পড়ে কিনা তা নির্ধারণ করার জন্য এটি একটি ফাঁকা সংকেত উত্পন্ন করে।
এছাড়াও, এটি কে-লাইন মোডগুলি সনাক্ত করে, মিথ্যা ব্রেকআউটগুলি ফিল্টার করার জন্য কয়েকটি কে-লাইনকে ক্রমিকভাবে সারিবদ্ধ করার জন্য অনুরোধ করে; এবং দামের পরিবর্তনশীলতার সূচকগুলি গণনা করে, যাতে চ্যানেলের মধ্যে ঝাঁকুনিতে আটকে না পড়ে; এবং একটি ট্রেডিং ভলিউম সূচক যুক্ত করে যাতে নিশ্চিত করা যায় যে ব্রেকআউট সময়টি অনুসরণ করতে পারে।
স্টপ লস-এর ক্ষেত্রে, এই কৌশলটি স্বনির্ধারিত স্টপ লস ব্যবহার করে। সাম্প্রতিক সময়ের অস্থিরতার উপর ভিত্তি করে স্টপ লস-এর মাত্রাটি গতিশীলভাবে সামঞ্জস্য করে। এটি স্টপ লস-এর গ্যারান্টি দেওয়ার সাথে সাথে যতটা সম্ভব ট্রেন্ডিং পরিস্থিতি অনুসরণ করতে পারে।
এই কৌশলটির সবচেয়ে বড় সুবিধা হল যে ট্রেডিং সিগন্যাল গঠনের জন্য বিচারক নিয়মগুলি কঠোর, যা কার্যকরভাবে অপ্রচলিত মিথ্যা ব্রেকআউটগুলিকে ফিল্টার করতে পারে এবং সত্যিকারের বাজারের প্রবণতা পাল্টানোর পয়েন্টগুলিকে ধরতে পারে। বিশেষত, নিম্নলিখিত কয়েকটি দিক রয়েছেঃ
মাল্টি-চ্যানেল এবং মুভিং এভারেজ সমন্বয়, বিচারক আরও কঠোর, যা ভুল বিচার সম্ভাবনা কমাতে পারে।
K লাইন ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে ক্রমিকভাবে
মূল্য পরিবর্তনের হার সূচকগুলির সাথে মিলিত করে, আপনি সিদ্ধান্ত নিতে পারেন যে আপনি পুনরুদ্ধারে প্রবেশ করেছেন কিনা, যাতে আপনি বিপরীত হওয়ার সুযোগটি মিস করবেন না।
ক্যাপাসিটি ইন্ডিকেটর যুক্ত করুন, কেবলমাত্র ক্যাপাসিটি মূল্যের সাথে উপস্থিত হলেই সংকেত তৈরি হবে, যাতে অকার্যকর বিরতি এড়ানো যায়।
স্বনির্ধারিত স্টপ-লস মেকানিজম, যা স্টপ-লস গ্যারান্টিযুক্ত অবস্থায় ট্রেন্ড লভ্যাংশকে সর্বাধিক লক করতে পারে।
সুতরাং, এই কৌশলটি সামগ্রিকভাবে কনফিগারেশন অপ্টিমাইজেশান, সিদ্ধান্ত গ্রহণের কঠোরতা এবং স্ব-অনুকূলিতকরণের জন্য উপযুক্ত।
যদিও এই কৌশলটি ভুয়া অনুপ্রবেশ এবং ইন্টারপ্রেস প্রবণতা ফিল্টার করার জন্য অনেক উন্নতি করেছে, তবুও কিছু ঝুঁকি রয়েছে যা সম্পর্কে সতর্ক হওয়া দরকারঃ
প্যারামিটার সেট করা খুব জটিল, বিভিন্ন প্যারামিটার সমন্বয়ের কার্যকারিতার মধ্যে বড় পার্থক্য রয়েছে, প্রচুর পরীক্ষার পরে সর্বোত্তম প্যারামিটার খুঁজে বের করা প্রয়োজন, এবং ভুল সেট করা খুব বেশি ভুল সংকেত তৈরি করতে পারে।
দ্রুত গড় এবং ঘন্টার পর ঘন্টা গড়ের ব্যবধান ঘন ঘন পজিশন খোলার এবং পজিশন খোলার জন্য প্রবণতা সৃষ্টি করে, যা দীর্ঘস্থায়ী ট্রেন্ড অনুসরণ করতে অক্ষম।
স্বনির্ধারিত ক্ষতি বন্ধের ব্যবস্থার ক্ষতি বন্ধের পরিমাণ গণনা করা হয় সহজ স্ট্যান্ডার্ড ডিভেরিয়েন্টের উপর নির্ভর করে, যা চরম পরিস্থিতিতে খুব কম ক্ষতি হতে পারে।
প্রযুক্তিগত সূচকগুলির উপর অত্যধিক নির্ভরশীলতা, মৌলিকভাবে গুরুত্বপূর্ণ পরিবর্তনের ক্ষেত্রে প্রতিক্রিয়া জানাতে অসুবিধা।
এই কৌশলটি প্রবণতা অনুসরণ করার একটি কৌশল, যা সামগ্রিকভাবে অস্থির বাজারে খারাপ কাজ করে।
এই ঝুঁকির মোকাবিলায় নিম্নলিখিত পদক্ষেপগুলি গ্রহণের পরামর্শ দেওয়া হচ্ছেঃ
মেশিন লার্নিং এবং অন্যান্য পদ্ধতি ব্যবহার করে প্যারামিটার অপ্টিমাইজেশান বিবেচনা করা যেতে পারে।
চ্যানেলের ব্যবধান যথাযথভাবে প্রশস্ত করা, স্থানান্তরিত গড়ের সময়কাল যথাযথভাবে দীর্ঘায়িত করা এবং অপ্রয়োজনীয় খোলার ফ্রিকোয়েন্সি হ্রাস করা যেতে পারে।
হিজ ফান্ডের মতো আরও উন্নত ওভাররাইডিং মডেলের ব্যবহার বিবেচনা করা যেতে পারে।
প্রযুক্তিগত সূচকগুলির উপর ভিত্তি করে ট্রেডিং এড়ানোর জন্য যথাসময়ে মৌলিক তথ্য পড়ুন।
মার্কেটের অবস্থা সম্পর্কে বিচার করার জন্য, অস্থির বাজারে লেনদেন স্থগিত করা।
এই কৌশলটি আরও উন্নত করা যেতে পারেঃ
মেশিন লার্নিং অ্যালগরিদম যুক্ত করুন, প্যারামিটারগুলি স্বয়ংক্রিয়ভাবে অনুকূলিতকরণ করুন। বিভিন্ন বাজার পরিবেশে প্যারামিটারগুলির পারফরম্যান্স রেকর্ড করতে, অনুসন্ধান টেবিল তৈরি করতে এবং গতিশীল অনুকূলিতকরণ করতে পারেন।
বাজারের অবস্থা সম্পর্কে বিচার বাড়ানো, যেমন ট্রেন্ডিং বা ঝড়ের মডিউল বাড়ানো, ঝড়ের বাজারে ট্রেডিং স্থগিত করা, অপ্রয়োজনীয় ক্ষতি এড়ানো।
ক্ষতি বন্ধ করার কৌশলটি অপ্টিমাইজ করুন, ট্র্যাকিং ক্ষতি, অনুপাত ক্ষতি বন্ধ এবং অন্যান্য ক্ষতি বন্ধ করার উপায় বিবেচনা করুন।
মূলধারার উপাদান যোগ করা, যখন বড় মূলধারার ঘটনা ঘটে তখন সতর্কতা জারি করা, কেবলমাত্র প্রযুক্তিগত সূচকগুলির উপর নির্ভর করে ক্ষতি হওয়া এড়ানো।
এই কৌশলটি অন্যান্য অপ্রাসঙ্গিক কৌশলগুলির সাথে মিশ্রিত করে একটি পোর্টফোলিও অপ্টিমাইজ করা যায় যা ঝুঁকিকে আরও ছড়িয়ে দিতে পারে।
কোয়ান্টাম ট্রেডিং ফ্রেমওয়ার্কে যোগদান, স্বয়ংক্রিয়ভাবে সিগন্যাল কার্যকর করা এবং কঠোর ঝুঁকি নিয়ন্ত্রণ করা।
সামগ্রিকভাবে, এই কৌশলটি ক্রিপ্টোকারেন্সি বাজারের প্রবণতা সুযোগগুলি ক্যাপচার করার জন্য সামগ্রিকভাবে উপযুক্ত। এটি মাল্টি-চ্যানেল এবং মুভিং এভারেজ ব্যবহার করে ট্রেডিং সিগন্যাল তৈরি করে এবং কার্যকরভাবে মিথ্যা ব্রেকআউটের গোলমালকে ফিল্টার করে, ট্রেন্ডিং মুনাফা লক করতে সফল হয়। তবে প্যারামিটার অপ্টিমাইজেশন, স্টপ লস পদ্ধতি এবং বাজার স্থিতির বিচার ইত্যাদির বিষয়ে এখনও মনোযোগ দেওয়া দরকার। যদি ক্রমাগত উন্নতি করা যায় তবে বিনিয়োগের স্থিতিশীল রিটার্ন পাওয়ার আশা করা যায়। এটি একটি ভাল উদাহরণ হিসাবে একটি পরিমাণযুক্ত ট্রেডিং কৌশল ডিজাইন করে।
/*backtest
start: 2022-09-21 00:00:00
end: 2023-09-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy("Extremely Overfit", overlay=true, commission_type=strategy.commission.percent, commission_value=.16, default_qty_type=strategy.percent_of_equity, default_qty_value=100, pyramiding = 1)
price = close
goLong = input(title="go long?", type=input.bool, defval=true)
goShort = input(title="go short?", type=input.bool, defval=true)
//trendRestrict = input(title="basic trend restriction?", type=input.bool, defval=false)
dynamicRestrict = true //input(title="dynamic trend restriction?", type=input.bool, defval=true)
longtrendimpt = true //input(title="additional weight on long-term trends?", type=input.bool, defval=true)
volRestrict = true //input(title="volume restriction?", type=input.bool, defval=true)
conservativeClose = false //input(title="conservative order closing?", type=input.bool, defval=false)
Restrictiveness = input ( -40,step=10,title ="Restrictiveness (higher = make fewer trades)")
volatilityImportance = 3.2 //input( 3.2, step = 0.1, minval = 0)
fastChannelLength = input( 6 )
fastChannelMargin = input ( 3.2, step = 0.1, minval = 0)
slowChannelLength = input ( 6, step = 1, minval = 0)
slowChannelMargin = input ( 1.5, step = 0.1, minval = 0)
fastHMAlength = input (4, step = 1, minval = 0)
stopLoss = input( 3, step = 0.1, minval = 0)
//altClosePeriod = input( 27, step = 1, minval = 1)
//altCloseFactor = input( 4.9, step = 0.1)
stopLossFlexibility = 50 //input(50, step=10, title="effect of volatility on SL?")
volumeMAlength = 14 //input ( 14, step = 1, minval = 1)
volumeVolatilityCutoff = 3.8 // ( 3.8, step = 1, minval = 0)
trendSensitivity = 3.8 //input ( 3.8, step = 0.1)
obvLookback = 10 //input(10, step = 10, minval = 10)
obvCorrThreshold = 0.89 //input(0.89, step = 0.01)
ROClength = 80 //input( 80, step = 10)
ROCcutoff = 5.6 //input( 5.6, step=0.1)
trendRestrict = false
//trendLookback = input ( 360, step = 10, minval = 10)
//longTrendLookback = input(720, step = 10, minval = 10)
//longTrendImportance = input(1.5, step = 0.05)
trendLookback = 360
longTrendLookback = 720
longTrendImportance = 1.5
//conservativeness = input( 2.4, step = 0.1)
conservativeness = 0
//trendPower = input( 0, step=1)
trendPower = 0
//conservativenessLookback = input( 650, step = 10, minval = 0)
conservativenessLookback = 10
//consAffectFactor = input( 0.85,step=0.01)
consAffectFactor = 0.85
//volatilityLookback = input(50, step=1, minval=2)
volatilityLookback = int(50)
recentVol = stdev(price,volatilityLookback)/sqrt(volatilityLookback)
//price channel
fastChannel = ema(price, fastChannelLength)
fastChannelUB = fastChannel * (1 + (float(fastChannelMargin) / 1000)) + (recentVol * (float(volatilityImportance) * (1 + (Restrictiveness/100))))
fastChannelLB = fastChannel * (1 - (float(fastChannelMargin) / 1000)) - (recentVol * (float(volatilityImportance) * (1 + (Restrictiveness/100))))
fchU = ((fastChannelUB < open) and (fastChannelUB < close))
fchL = ((fastChannelLB > open) and (fastChannelLB > close))
//plot(fastChannelUB)
//plot(fastChannelLB)
//slow channel
//slowChannelLBmargin = input ( 2, step = 0.1, minval = 0 )
slowChannel = ema(ema(price,slowChannelLength),slowChannelLength)
slowChannelUB = slowChannel * (1 + (float(slowChannelMargin) / 2000)) + (recentVol * (float(volatilityImportance) * (1 + (Restrictiveness/100))))
slowChannelLB = slowChannel * (1 - (float(slowChannelMargin) / 2000)) - (recentVol * (float(volatilityImportance) * (1 + (Restrictiveness/100))))
schU = ((slowChannelUB < close))
schL = ((slowChannelLB > close))
cschU = (((slowChannelUB * (1 + conservativeness)) < close))
cschL = (((slowChannelUB * (1 - conservativeness)) > close))
//plot(slowChannel,color = #00FF00)
//plot(slowChannelUB,color = #00FF00)
//plot(slowChannelLB,color = #00FF00)
fastHMA = hma(price,fastHMAlength)
fastAboveUB = (fastHMA > slowChannelUB)
fastBelowLB = (fastHMA < slowChannelLB)
//plot(fastHMA, color = #FF0000, linewidth = 2)
//consecutive candles
//consecutiveCandlesReq = input(1, step = 1, minval = 1, maxval = 4)
consecutiveCandlesReq = 1
consecutiveBullReq = float(consecutiveCandlesReq)
consecutiveBearReq = float(consecutiveCandlesReq)
cbull = ((close[0] > close[1]) and (consecutiveBullReq == 1)) or (((close[0] > close[1]) and (close[1] > close[2])) and consecutiveBullReq == 2) or (((close[0] > close[1]) and (close[1] > close[2]) and (close[2] > close[3])) and consecutiveBullReq == 3) or (((close[0] > close[1]) and (close[1] > close[2]) and (close[2] > close[3]) and (close[3] > close[4])) and consecutiveBullReq == 4)
cbear = ((close[0] < close[1]) and (consecutiveBearReq == 1)) or (((close[0] < close[1]) and (close[1] < close[2])) and consecutiveBearReq == 2) or (((close[0] < close[1]) and (close[1] < close[2]) and (close[2] < close[3])) and consecutiveBearReq == 3) or (((close[0] < close[1]) and (close[1] < close[2]) and (close[2] < close[3]) and (close[3] < close[4])) and consecutiveBearReq == 4)
//trend detection
//trendCutoff = input(0, step = 0.1)
trendCutoff = 0
trendDetectionPct = float(trendCutoff/100)
trendVal = float((close[0] - close[trendLookback])/close[0])
trendUp = (trendVal > (0 + trendDetectionPct))
trendDown = (trendVal < (0 - trendDetectionPct))
//plot(trendVal+36.5,linewidth=2)
// peak indicators
peakHigh = ((fastHMA > fastChannelUB) and (fastChannelLB > slowChannelUB))
peakLow = ((fastHMA < fastChannelLB) and (fastChannelUB < slowChannelLB))
TpeakHigh = (fastHMA > fastChannelUB) and (fastChannelUB > slowChannelUB)
TpeakLow = (fastHMA < fastChannelUB) and (fastChannelLB < slowChannelLB)
//TpeakHigh = (fastHMA > fastChannelUB) and (fastChannelLB > avg(slowChannelUB,slowChannelLB))
//TpeakLow = (fastHMA < fastChannelUB) and (fastChannelUB < avg(slowChannelLB,slowChannelUB))
//TpeakHigh = ((crossover(fastHMA,fastChannelUB)) and (fastChannelLB > slowChannelUB))
//TpeakLow = ((crossover(fastChannelLB,fastHMA)) and (fastChannelUB < slowChannelLB))
//TpeakHigh = (fastHMA > (fastChannelUB * (1 + (trendPower/800)))) and (fastChannelUB > (slowChannelUB * (1 + (trendPower/800))))
//TpeakLow = (fastHMA < (fastChannelUB * (1 - (trendPower/800)))) and (fastChannelLB < (slowChannelLB * (1 - (trendPower/800))))
//TpeakHigh = (fastHMA > (fastChannelUB * (1 + (trendPower/800)))) and (avg(fastChannelUB,fastChannelLB) > (slowChannelUB * (1 + (trendPower/800))))
//TpeakLow = (fastHMA < (fastChannelUB * (1 - (trendPower/800)))) and (avg(fastChannelLB,fastChannelUB) < (slowChannelLB * (1 - (trendPower/800))))
//plot(fastChannelUB * (1 + (trendPower/700)), color=#FF69B4)
// and for closing...
closeLong = (crossover(fastHMA,fastChannelUB) and (fastChannelLB > slowChannelUB))
closeShort = (crossover(fastChannelLB,fastHMA) and (fastChannelUB < slowChannelLB))
//closeLong = (crossover(fastHMA,fastChannelUB) and (fastChannelLB > slowChannelUB)) or (roc(price,altClosePeriod) > altCloseFactor)
//closeShort = (crossover(fastChannelLB,fastHMA) and (fastChannelUB < slowChannelLB)) or (roc(price,altClosePeriod) < (altCloseFactor) * -1)
//closeLong = (crossover(fastHMA,fastChannelUB) and (fastChannelLB > slowChannelUB)) or (((price - fastChannelUB) > (altCloseFactor * abs(((fastChannelUB - fastChannelLB)/2) - ((slowChannelUB - slowChannelLB)/2)))) and (fastChannelLB > slowChannelUB))
//closeShort = (crossover(fastChannelLB,fastHMA) and (fastChannelUB < slowChannelLB)) or (((fastChannelLB - price) > (altCloseFactor * abs(((fastChannelUB - fastChannelLB)/2) - ((slowChannelUB - slowChannelLB)/2)))) and (fastChannelUB < slowChannelLB))
//closeLong = crossover(fastHMA,fastChannelUB) and ((fastChannelLB[0] - fastChannelLB[1]) < (slowChannelUB[0] - slowChannelUB[1]))
//closeShort = crossover(fastChannelLB,fastHMA) and ((fastChannelUB[0] - fastChannelUB[1]) > (slowChannelLB[0] - slowChannelLB[1]))
//stop-loss
priceDev = stdev(price,trendLookback) * (1 + stopLossFlexibility/5)
stopLossMod = stopLoss * (1 + (priceDev/price))
//longStopPrice = strategy.position_avg_price * (1 - (stopLoss/100))
//shortStopPrice = strategy.position_avg_price * (1 + (stopLoss/100))
longStopPrice = strategy.position_avg_price * (1 - (stopLossMod/100))
shortStopPrice = strategy.position_avg_price * (1 + (stopLossMod/100))
// volume
volumeMA = ema(volume,volumeMAlength)
volumeDecrease = ((not volRestrict ) or (volumeMA[0] < ema(volumeMA[1] * (1 - (volumeVolatilityCutoff/100)),5)))
volumeCutoff = ema(volumeMA[1] * (1 - (volumeVolatilityCutoff/100)),5)
//plot(volumeMA)
//plot(volumeCutoff)
// detect volatility
//trendinessLookback = input ( 600, step = 10, minval = 0)
trendinessLookback = trendLookback
trendiness = (stdev(price,trendinessLookback)/price) * (1 - (Restrictiveness/100))
longtermTrend = ((price - price[longTrendLookback])/price)
//dynamicTrendDetected = (dynamicRestrict and (abs(trendiness * 100) < trendSensitivity))
dynamicTrendDetected = (longtrendimpt and (dynamicRestrict and (abs(trendiness * 100) < (trendSensitivity+(longtermTrend * longTrendImportance))))) or (not longtrendimpt and ((dynamicRestrict and (abs(trendiness * 100) < trendSensitivity))))
// adapt conservativeness to volatility
//consVal = sma(((stdev(price,conservativenessLookback))/price)*100,25)
consVal = sma(((stdev(price,conservativenessLookback))/price)*100,25)
cVnorm = sma(avg(consVal,3),60)
cVal = consVal - cVnorm
//conservativenessMod = conservativeness * (cVal * consAffectFactor)
conservativenessMod = conservativeness * (consVal * consAffectFactor)
//plot(consVal,linewidth=4)
//plot(cVnorm,color = #00FF00)
//plot(cVal,linewidth=2)
// ROC cutoff (for CLOSING)
//rocCloseLong = (ema(roc(price,ROClength),10) > ROCcutoff)
//rocCloseShort = (ema(roc(price,ROClength),10) < (ROCcutoff * -1))
ROCval = roc(price,ROClength)
ROCema = ema(ROCval,30)
ROCabs = abs(ROCema)
ROCallow = ROCabs < ROCcutoff
ROCallowLong = (ROCabs < ROCcutoff) or ((ROCabs >= ROCcutoff) and ((fastChannelLB < slowChannelLB) and (fastHMA < fastChannelLB)))
ROCallowShort = (ROCabs < ROCcutoff) or ((ROCabs >= ROCcutoff) and ((fastChannelUB > slowChannelUB) and (fastHMA > fastChannelUB)))
//plot(ROCallow)
// obv
evidence_obv = (correlation(price,obv[0],obvLookback))
obvAllow = evidence_obv > obvCorrThreshold
//if (not na(vrsi))
if trendRestrict or dynamicTrendDetected
//if (strategy.position_size == 0)
if not (strategy.position_size < 0)
if trendUp
//if cbear and schL and fchL and trendUp and goLong
if cbear and TpeakLow and volumeDecrease and ROCallow and goLong and obvAllow
//if cbear and peakLow and rocHigh and volumeDecrease and goLong
strategy.entry("Long", strategy.long, comment="Long")
if not (strategy.position_size > 0)
if trendDown
//if cbull and schU and fchU and trendDown and goShort
if cbull and TpeakHigh and volumeDecrease and ROCallow and goShort and obvAllow
//if cbull and peakHigh and rocLow and volumeDecrease and goShort
strategy.entry("Short", strategy.short, comment="Short")
else
//if (strategy.position_size == 0)
if not (strategy.position_size < 0)
//if cbear and peakLow and goLong
//if cbear and peakLow and volumeDecrease and ROCallow and goLong
if TpeakLow and goLong and obvAllow
strategy.entry("Long", strategy.long, comment="Long")
if not (strategy.position_size > 0)
//if cbull and peakHigh and goShort
//if cbull and peakHigh and volumeDecrease and ROCallow and goShort
if TpeakHigh and goShort and obvAllow
strategy.entry("Short", strategy.short, comment="Short")
if conservativeClose
//pkHigh = ((fastHMA > fastChannelUB) and (fastChannelUB > (slowChannelUB * (1 + conservativeness/1000))))
//pkLow = ((fastHMA < fastChannelLB) and (fastChannelLB < (slowChannelLB * (1 - conservativeness/1000))))
//pkHigh = ((fastHMA > fastChannelUB) and (fastChannelUB > (slowChannelUB * (1 + conservativenessMod/1000))))
//pkLow = ((fastHMA < fastChannelLB) and (fastChannelLB < (slowChannelLB * (1 - conservativenessMod/1000))))
pkHigh = ((fastHMA > fastChannelUB) and (fastChannelUB > (slowChannelUB * (1 + ((conservativenessMod/1000) * (1 - Restrictiveness/100))))))
pkLow = ((fastHMA < fastChannelLB) and (fastChannelLB < (slowChannelLB * (1 - ((conservativenessMod/1000) * (1 - Restrictiveness/100))))))
if (strategy.position_size > 0)
//if fastAboveUB
//if pkHigh and closeLong
if closeLong
strategy.close("Long", comment="closeLong")
if (strategy.position_size < 0)
//if fastBelowLB
//if pkLow and closeShort
if closeShort
strategy.close("Short", comment="closeShort")
else
if (strategy.position_size > 0)
//if fastAboveUB
if peakHigh
strategy.close("Long", comment="closeLong")
if (strategy.position_size < 0)
//if fastBelowLB
if peakLow
strategy.close("Short", comment="closeShort")
if (strategy.position_size > 0)
strategy.exit(id="Long", stop=longStopPrice, comment="stopLong")
if (strategy.position_size < 0)
strategy.exit(id="Short", stop=shortStopPrice, comment="stopShort")
//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)