
اس حکمت عملی میں نسبتا weak مضبوط اشاریہ ((RSI) اور مارٹینگل پوزیشننگ کا اصول شامل ہے۔ جب RSI oversold لائن سے کم ہو تو ، پہلی بار خریدیں اور پوزیشن کھولیں؛ اس کے بعد اگر قیمتیں نیچے جارہی ہیں تو ، منافع کو روکنے کے لئے 2 کے اشاریہ پر پوزیشن لگائیں۔ یہ حکمت عملی اعلی مارکیٹ ویلیو والی کرنسیوں میں نقد تجارت کے لئے موزوں ہے ، جو طویل مدتی مستحکم منافع حاصل کرسکتی ہے۔
یہ حکمت عملی آر ایس آئی اشارے اور مارٹینگل بیجنگ اصول کے ساتھ مل کر ، اوور سیل پوائنٹس کا فیصلہ کرتے وقت مناسب بیجنگ کرتے ہیں ، اور چھوٹے اسٹاپ مارجن سے فائدہ اٹھاتے ہیں۔ اس سے مستقل مستحکم منافع حاصل کیا جاسکتا ہے ، لیکن اس میں کچھ خطرہ بھی ہوتا ہے۔ اس کو مزید بہتر بنانے کے لئے اسٹاپ نقصانات ، ایڈجسٹمنٹ پیرامیٹرز وغیرہ کی ترتیب دی جاسکتی ہے۔
/*backtest
start: 2024-01-06 00:00:00
end: 2024-02-05 00:00:00
period: 1h
basePeriod: 15m
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/
// © Stavolt
//@version=5
strategy("RSI Martingale Strategy", overlay=true, default_qty_type=strategy.cash, currency=currency.USD)
// Inputs
rsiLength = input(14, title="RSI Length")
oversoldThreshold = input(30, title="Oversold Threshold") // Keeping RSI threshold
profitTargetPercent = input(0.5, title="Profit Target (%)") / 100
initialInvestmentPercent = input(5, title="Initial Investment % of Equity")
// Calculating RSI
rsiValue = ta.rsi(close, rsiLength)
// State variables for tracking the initial entry
var float initialEntryPrice = na
var int multiplier = 1
// Entry condition based on RSI
if (rsiValue < oversoldThreshold and na(initialEntryPrice))
initialEntryPrice := close
strategy.entry("Initial Buy", strategy.long, qty=(strategy.equity * initialInvestmentPercent / 100) / close)
multiplier := 1
// Adjusting for errors and simplifying the Martingale logic
// Note: This section simplifies the aggressive position size adjustments without loops
if (not na(initialEntryPrice))
if (close < initialEntryPrice * 0.995) // 0.5% drop from initial entry
strategy.entry("Martingale Buy 1", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 2)
multiplier := 2 // Adjusting multiplier for the next potential entry
if (close < initialEntryPrice * 0.990) // Further drop
strategy.entry("Martingale Buy 2", strategy.long, qty=((strategy.equity * initialInvestmentPercent / 100) / close) * 4)
multiplier := 4
// Additional conditional entries could follow the same pattern
// Checking for profit target to close positions
if (strategy.position_size > 0 and (close - strategy.position_avg_price) / strategy.position_avg_price >= profitTargetPercent)
strategy.close_all(comment="Take Profit")
initialEntryPrice := na // Reset for next cycle