
এই কৌশলটি লিনিয়ার রিটার্ন এবং ওঠানামার সূচকগুলি ব্যবহার করে বিভিন্ন বাজার পরিস্থিতি সনাক্ত করতে এবং যখন ক্রয় বা বিক্রয়ের শর্ত পূরণ হয় তখন কৌশলটি সংশ্লিষ্ট মাল্টি-হেড বা খালি অবস্থানের অবস্থান স্থাপন করে। একই সাথে, এই কৌশলটি বাজারের অবস্থার উপর নির্ভর করে প্যারামিটারগুলিকে অপ্টিমাইজ এবং সামঞ্জস্য করার অনুমতি দেয়, যাতে বিভিন্ন বাজার পরিবেশের সাথে খাপ খাইয়ে নেওয়া যায়। কৌশলটি ট্রেডিং সংকেত নিশ্চিত করার জন্য অতিরিক্ত সূচক হিসাবে সূচকীয় চলমান গড় ব্যবহার করে।
এই কৌশলটি বাজারের অবস্থাকে চিহ্নিত করে এবং ইএমএকে নিশ্চিতকরণ সূচক হিসাবে ব্যবহার করে একটি দৃ strong়, যুক্তিসঙ্গতভাবে স্পষ্ট ট্রেডিং কৌশল তৈরি করে। কৌশলটির সুবিধা হ’ল প্রবণতা এবং অস্থিরতার সংমিশ্রণ এবং বিভিন্ন বাজারের পরিবেশের জন্য প্যারামিটার অপ্টিমাইজেশনের অনুমতি দেয়। তবে কৌশলটি প্যারামিটার নির্বাচন, বাজারের ঝড় এবং কালো ভ্যান্টের ইভেন্টের মতো ঝুঁকিও রয়েছে, যা বাস্তব প্রয়োগে ক্রমাগত অপ্টিমাইজেশন এবং উন্নত ভবিষ্যতের প্রয়োজন। কৌশলটি স্থিতিশীলতা এবং লাভজনকতা বাড়ানোর জন্য সমৃদ্ধ সংকেত উত্স, প্যারামিটার নির্বাচন, ঝুঁকি নিয়ন্ত্রণ ব্যবস্থা উন্নত করার মতো দিক থেকে উন্নত করা যেতে পারে।
/*backtest
start: 2023-05-22 00:00:00
end: 2024-05-27 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tmalvao
//@version=5
strategy("Regime de Mercado com Regressão e Volatilidade Otimizado", overlay=true)
// Parâmetros para otimização
upperThreshold = input.float(1.0, title="Upper Threshold")
lowerThreshold = input.float(-1.0, title="Lower Threshold")
length = input.int(50, title="Length", minval=1)
// Indicadores de volatilidade
atrLength = input.int(14, title="ATR Length")
atrMult = input.float(2.0, title="ATR Multiplier")
atr = ta.atr(atrLength)
volatility = atr * atrMult
// Calculando a regressão linear usando função incorporada
intercept = ta.linreg(close, length, 0)
slope = ta.linreg(close, length, 1) - ta.linreg(close, length, 0)
// Sinal de compra e venda
buySignal = slope > upperThreshold and close > intercept + volatility
sellSignal = slope < lowerThreshold and close < intercept - volatility
// Entrando e saindo das posições
if (buySignal)
strategy.entry("Buy", strategy.long)
if (sellSignal)
strategy.entry("Sell", strategy.short)
// Indicadores adicionais para confirmação
emaFastLength = input.int(10, title="EMA Fast Length")
emaSlowLength = input.int(50, title="EMA Slow Length")
emaFast = ta.ema(close, emaFastLength)
emaSlow = ta.ema(close, emaSlowLength)
// Confirmando sinais com EMAs
if (buySignal and emaFast > emaSlow)
strategy.entry("Buy Confirmed", strategy.long)
if (sellSignal and emaFast < emaSlow)
strategy.entry("Sell Confirmed", strategy.short)
// Exibindo informações no gráfico
plot(slope, title="Slope", color=color.blue)
plot(intercept, title="Intercept", color=color.red)
plot(volatility, title="Volatility", color=color.green)
hline(upperThreshold, "Upper Threshold", color=color.green, linestyle=hline.style_dotted)
hline(lowerThreshold, "Lower Threshold", color=color.red, linestyle=hline.style_dotted)