
ڈبل مساوی کراس متحرک پوزیشن ہولڈنگ حکمت عملی ایک مقداری تجارتی حکمت عملی ہے جس میں دو مختلف دورانیے کے سادہ حرکت پذیر اوسط ((SMA) کراس سگنل پر مبنی تجارت کی جاتی ہے۔ یہ حکمت عملی قلیل مدتی اور طویل مدتی حرکت پذیر اوسط کی کراس کا استعمال کرتے ہوئے مارکیٹ کے رجحانات کا اندازہ لگاتی ہے ، اور کراس سگنل اور قیمت اور طویل مدتی مساوی لائن کے مابین تعلقات کی متحرک سمت کے مطابق پوزیشن کی سمت کو ایڈجسٹ کرتی ہے۔ حکمت عملی ایک دن کے چارٹ پر چلتی ہے ، جس میں مختلف حرکت پذیر اوسط پیرامیٹرز کو ترتیب دے کر حکمت عملی کی حساسیت اور ردعمل کی رفتار کو لچکدار طریقے سے ایڈجسٹ کیا جاسکتا ہے۔
ڈبل لائن کراس متحرک پوزیشن ہولڈنگ حکمت عملی ایک کلاسیکی اور عملی مقدار میں تجارت کا ایک طریقہ ہے جس میں مارکیٹ کے رجحانات کو پکڑنے کے ل the مارکیٹ کے رجحانات کو پکڑنے کے ل.۔ اس حکمت عملی کو سمجھنے میں آسان ، مکمل طور پر خود کار ہے ، اور اس میں بہتر رجحانات کی پیروی کرنے کی صلاحیت اور لچک ہے۔ تاہم ، اس حکمت عملی میں بھی ممکنہ خطرات موجود ہیں ، جیسے کہ مارکیٹ کی خراب کارکردگی ، سگنل کی تاخیر۔ دیگر تکنیکی اشارے متعارف کرانے ، پیرامیٹرز کو بہتر بنانے ، اسٹاپ نقصان کے طریقہ کار میں شامل ہونے اور اس طرح کے طریقوں سے حکمت عملی کی استحکام اور منافع کو مزید بہتر بنایا جاسکتا ہے۔ اس حکمت عملی کو استعمال کرتے وقت ، تاجروں کو مخصوص تجارت کی اقسام اور مارکیٹ کے ماحول کے مطابق مناسب پیرامیٹرز کو ایڈجسٹ کرنے اور خطرے کا انتظام کرنے کی ضرورت ہے ، تاکہ طویل مدتی مستحکم تجارتی نتائج حاصل کیے جاسکیں۔
/*backtest
start: 2024-06-29 00:00:00
end: 2024-07-29 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy(title="MA Cross Backtest", overlay=true, default_qty_type=strategy.cash, default_qty_value=10)
// Parâmetros das Médias Móveis
shortlen = input.int(9, "Short MA Length", minval=1)
longlen = input.int(21, "Long MA Length", minval=1)
// Cálculo das Médias Móveis
short = ta.sma(close, shortlen)
long = ta.sma(close, longlen)
// Plotagem das Médias Móveis
plot(short, color=color.orange, title="Short MA")
plot(long, color=color.green, title="Long MA")
// Sinal de Compra baseado no cruzamento das médias móveis
buySignal = ta.crossover(short, long)
// Sinal de Venda (Short) baseado no cruzamento das médias móveis
sellSignal = ta.crossunder(short, long)
// Plotagem dos Sinais de Compra e Venda
plotshape(series=buySignal, location=location.belowbar, color=color.blue, style=shape.labelup, text="Buy", title="Buy Signal")
plotshape(series=sellSignal, location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell", title="Sell Signal")
// Condições para alertas
alertcondition(buySignal, title="Buy Signal", message="MA Cross Buy Signal")
alertcondition(sellSignal, title="Sell Signal", message="MA Cross Sell Signal")
// Lógica da Estratégia de Backtest
if (buySignal)
// Se não há posição aberta ou se a posição atual é curta, feche a posição curta antes de abrir uma nova posição longa
if (strategy.position_size < 0)
strategy.close("Short", comment="Closing Short Position before Long Entry")
strategy.entry("Long", strategy.long)
// Alerta de compra
alert("MA Cross Buy Signal", alert.freq_once_per_bar_close)
if (strategy.position_size > 0)
// Se o preço abrir abaixo da média longa
if (open < long)
strategy.close("Long", comment="Price Opened Below Long MA")
strategy.entry("Short", strategy.short, comment="Switched to Short")
// Alerta de venda
alert("Price Opened Below Long MA - Switched to Short", alert.freq_once_per_bar_close)
// Se a média móvel curta cruzar abaixo da média móvel longa
else if (sellSignal)
strategy.close("Long", comment="Short MA Crossed Below Long MA")
strategy.entry("Short", strategy.short, comment="Switched to Short")
// Alerta de venda
alert("Short MA Crossed Below Long MA - Switched to Short", alert.freq_once_per_bar_close)
if (strategy.position_size < 0)
// Se o preço abrir acima da média longa
if (open > long)
strategy.close("Short", comment="Price Opened Above Long MA")
strategy.entry("Long", strategy.long, comment="Switched to Long")
// Alerta de compra
alert("Price Opened Above Long MA - Switched to Long", alert.freq_once_per_bar_close)