
یہ حکمت عملی ایک مکمل تجارتی نظام ہے جس میں تکنیکی اشارے کی ایک سیریز شامل ہے ، جس میں بنیادی طور پر تجارت کے فیصلے کی بنیاد پر اشارے ہیں۔ یہ نظام اینٹینا ٹینکان اور بیس لائن کیجون کے کراسنگ کے ذریعے انٹری ٹائمنگ کا تعین کرتا ہے ، جبکہ نسبتا weak مضبوط اشاریہ (آر ایس آئی) اور منتقل اوسط (ایم اے) کو معاون فلٹرنگ شرائط کے طور پر جوڑتا ہے۔ حکمت عملی نے بادل کے اجزاء کو متحرک اسٹاپ نقصان کی حیثیت سے اپنایا ، جس سے ایک مکمل رسک کنٹرول سسٹم تشکیل دیا گیا۔
حکمت عملی کی بنیادی منطق درج ذیل کلیدی عناصر پر مبنی ہے:
یہ حکمت عملی متعدد تکنیکی اشارے کو ملا کر ایک مکمل تجارتی نظام بناتی ہے۔ حکمت عملی نہ صرف سگنل کی پیداوار پر توجہ دیتی ہے ، بلکہ اس میں ایک مکمل رسک کنٹرول میکانزم بھی شامل ہے۔ متعدد فلٹرنگ شرائط کی ترتیب کے ذریعہ ، تجارت کی کامیابی کی شرح کو مؤثر طریقے سے بڑھایا جاتا ہے۔ اس کے علاوہ ، متحرک اسٹاپ نقصان کا ڈیزائن حکمت عملی کو ایک اچھا رسک ریٹرن بھی فراہم کرتا ہے۔ اگرچہ کچھ اصلاحات کی گنجائش موجود ہے ، لیکن مجموعی طور پر یہ ایک منظم ، منطقی طور پر واضح حکمت عملی کا نظام ہے۔
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-27 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Ichimoku Strategy with Optional RSI, MA Filters and Alerts", overlay=true)
// Input for date and time filter
startDate = input(timestamp("2020-01-01 00:00"), title="Start Date")
endDate = input(timestamp("2023-01-01 00:00"), title="End Date")
// Inputs for Ichimoku settings
tenkanPeriod = input.int(9, title="Tenkan Period")
kijunPeriod = input.int(26, title="Kijun Period")
senkouBPeriod = input.int(52, title="Senkou B Period")
// Inputs for Moving Average settings
useMAFilter = input.bool(true, title="Enable Moving Average Filter?")
ma50Period = input.int(50, title="50-day MA Period")
ma200Period = input.int(200, title="200-day MA Period")
// Inputs for RSI settings
useRSIFilter = input.bool(true, title="Enable RSI Filter?")
rsiPeriod = input.int(14, title="RSI Period")
rsiOverbought = input.int(70, title="RSI Overbought Level")
rsiOversold = input.int(30, title="RSI Oversold Level")
// Ichimoku Cloud components
tenkan = (ta.highest(high, tenkanPeriod) + ta.lowest(low, tenkanPeriod)) / 2
kijun = (ta.highest(high, kijunPeriod) + ta.lowest(low, kijunPeriod)) / 2
senkouA = ta.sma(tenkan + kijun, 2) / 2
senkouB = (ta.highest(high, senkouBPeriod) + ta.lowest(low, senkouBPeriod)) / 2
chikou = close[26]
// Moving Averages
ma50 = ta.sma(close, ma50Period)
ma200 = ta.sma(close, ma200Period)
// Weekly RSI
rsiSource = request.security(syminfo.tickerid, "W", ta.rsi(close, rsiPeriod))
// Plotting the Ichimoku Cloud components
pTenkan = plot(tenkan, color=color.blue, title="Tenkan")
pKijun = plot(kijun, color=color.red, title="Kijun")
pSenkouA = plot(senkouA, color=color.green, title="Senkou A")
pSenkouB = plot(senkouB, color=color.maroon, title="Senkou B")
plot(chikou, color=color.purple, title="Chikou")
plot(ma50, color=color.orange, title="50-day MA")
plot(ma200, color=color.yellow, title="200-day MA")
// Corrected fill function
fill(pSenkouA, pSenkouB, color=senkouA > senkouB ? color.green : color.red, transp=90)
// Debugging: Output values on the chart to see if conditions are ever met
plotshape(series=(tenkan > kijun), color=color.blue, style=shape.triangleup, title="Tenkan > Kijun")
plotshape(series=(tenkan < kijun), color=color.red, style=shape.triangledown, title="Tenkan < Kijun")
plotshape(series=(ma50 > ma200), color=color.orange, style=shape.labelup, title="MA 50 > MA 200")
plotshape(series=(ma50 < ma200), color=color.yellow, style=shape.labeldown, title="MA 50 < MA 200")
// Define the trailing stop loss using Kumo
var float trailingStopLoss = na
// Check for MA conditions (apply only if enabled)
maConditionLong = not useMAFilter or (useMAFilter and ma50 > ma200)
maConditionShort = not useMAFilter or (useMAFilter and ma50 < ma200)
// Check for Ichimoku Cloud conditions
ichimokuLongCondition = close > math.max(senkouA, senkouB)
ichimokuShortCondition = close < math.min(senkouA, senkouB)
// Check for RSI conditions (apply only if enabled)
rsiConditionLong = not useRSIFilter or (useRSIFilter and rsiSource > rsiOverbought)
rsiConditionShort = not useRSIFilter or (useRSIFilter and rsiSource < rsiOversold)
// Combine conditions for entry
longCondition = maConditionLong and tenkan > kijun and ichimokuLongCondition and rsiConditionLong
shortCondition = maConditionShort and tenkan < kijun and ichimokuShortCondition and rsiConditionShort
// Date and time filter
withinDateRange = true
// Check for Long Condition
if (longCondition and withinDateRange)
strategy.entry("Long", strategy.long)
trailingStopLoss := math.min(senkouA, senkouB)
alert("Buy Signal: Entering Long Position", alert.freq_once_per_bar_close)
// Check for Short Condition
if (shortCondition and withinDateRange)
strategy.entry("Short", strategy.short)
trailingStopLoss := math.max(senkouA, senkouB)
alert("Sell Signal: Entering Short Position", alert.freq_once_per_bar_close)
// Exit conditions
exitLongCondition = close < kijun or tenkan < kijun
exitShortCondition = close > kijun or tenkan > kijun
if (exitLongCondition and strategy.position_size > 0)
strategy.close("Long")
alert("Exit Signal: Closing Long Position", alert.freq_once_per_bar_close)
if (exitShortCondition and strategy.position_size < 0)
strategy.close("Short")
alert("Exit Signal: Closing Short Position", alert.freq_once_per_bar_close)
// Apply trailing stop loss
if (strategy.position_size > 0)
strategy.exit("Trailing Stop Long", stop=trailingStopLoss)
else if (strategy.position_size < 0)
strategy.exit("Trailing Stop Short", stop=trailingStopLoss)