
یہ ایک دن میں تجارت کرنے والی حکمت عملی ہے جس کی بنیاد ٹرانزیکشن حجم وزن والے متحرک اوسط ((VWMA) پر ہے ، جس میں ایک جامع اختیارات کے پورٹ فولیو کے ذریعہ کثیر خلائی دو طرفہ آپریشن ہوتا ہے۔ حکمت عملی کا مرکز ہر ٹریڈنگ دن میں دوبارہ حساب کتاب کرنے والے وی ڈبلیو ایم اے اشارے ہیں ، جو قیمت کے مقابلے میں وی ڈبلیو ایم اے کی پوزیشن پر مبنی ٹریڈنگ سگنل تیار کرتے ہیں ، اور بند ہونے سے پہلے خود بخود صفائی کرتے ہیں۔ اس حکمت عملی میں پوزیشن مینجمنٹ اور ٹریڈنگ فریکوئنسی کی حدود سمیت ایک اچھا رسک کنٹرول میکانزم ہے۔
حکمت عملی کی بنیادی منطق درج ذیل نکات پر مبنی ہے:
یہ ایک منظم ، منطقی طور پر سخت دن کی تجارت کی حکمت عملی ہے۔ یہ مختصر مدت کے رجحانات کو پکڑنے کے لئے VWMA اشارے کے ذریعہ بنایا گیا ہے ، جو کہ ایک جامع اختیارات کے پورٹ فولیو کے ساتھ مل کر تجارت کرتا ہے ، اور اس میں ایک اچھا خطرہ کنٹرول میکانزم ہے۔ حکمت عملی کو بہتر بنانے کی جگہ بنیادی طور پر جھوٹے اشاروں کو کم کرنے ، عملدرآمد کی کارکردگی کو بہتر بنانے اور خطرے کے انتظام کے نظام کو بہتر بنانے میں ہے۔ اگرچہ اس میں کچھ حدود موجود ہیں ، لیکن مجموعی طور پر یہ ایک قابل قدر تجارتی نظام ہے۔
/*backtest
start: 2025-02-16 00:00:00
end: 2025-02-23 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Binance","currency":"SOL_USDT"}]
*/
//@version=5
strategy("Session VWMA Synthetic Options Strategy", overlay=true, initial_capital=100000,
default_qty_type=strategy.percent_of_equity, default_qty_value=10, pyramiding=10, calc_on_every_tick=true)
//──────────────────────────────
// Session VWMA Inputs
//──────────────────────────────
vwmaLen = input.int(55, title="VWMA Length", inline="VWMA", group="Session VWMA")
vwmaColor = input.color(color.orange, title="VWMA Color", inline="VWMA", group="Session VWMA", tooltip="VWMA resets at the start of each session (at the opening of the day).")
//──────────────────────────────
// Session VWMA Calculation Function
//──────────────────────────────
day_vwma(_start, s, l) =>
bs_nd = ta.barssince(_start)
v_len = math.max(1, bs_nd < l ? bs_nd : l)
ta.vwma(s, v_len)
//──────────────────────────────
// Determine Session Start
//──────────────────────────────
// newSession becomes true on the first bar of a new day.
newSession = ta.change(time("D")) != 0
//──────────────────────────────
// Compute Session VWMA
//──────────────────────────────
vwmaValue = day_vwma(newSession, close, vwmaLen)
plot(vwmaValue, color=vwmaColor, title="Session VWMA")
//──────────────────────────────
// Define Signal Conditions (only on transition)
//──────────────────────────────
bullCond = low > vwmaValue // Bullish: candle low above VWMA
bearCond = high < vwmaValue // Bearish: candle high below VWMA
// Trigger signal only on the bar where the condition first becomes true
bullSignal = bullCond and not bullCond[1]
bearSignal = bearCond and not bearCond[1]
//──────────────────────────────
// **Exit Condition at 15:29 IST**
//──────────────────────────────
sessionEnd = hour == 15 and minute == 29
// Exit all positions at 15:29 IST
if sessionEnd
strategy.close_all(comment="Closing all positions at session end")
//──────────────────────────────
// **Trade Control Logic**
//──────────────────────────────
var bool hasExited = true // Track if an exit has occurred since last entry
// Reset exit flag when a position is exited
if strategy.position_size == 0
hasExited := true
//──────────────────────────────
// **Position Management: Entry & Exit**
//──────────────────────────────
if newSession
hasExited := true // Allow first trade of the day
// On a bullish signal:
// • If currently short, close the short position and then enter long
// • Otherwise, add to any existing long position **only if an exit happened before**
if bullSignal and (hasExited or newSession)
if strategy.position_size < 0
strategy.close("Short", comment="Exit Short on Bull Signal")
strategy.entry("Long", strategy.long, comment="Enter Long: Buy Call & Sell Put at ATM")
else
strategy.entry("Long", strategy.long, comment="Add Long: Buy Call & Sell Put at ATM")
hasExited := false // Reset exit flag
// On a bearish signal:
// • If currently long, close the long position and then enter short
// • Otherwise, add to any existing short position **only if an exit happened before**
if bearSignal and (hasExited or newSession)
if strategy.position_size > 0
strategy.close("Long", comment="Exit Long on Bear Signal")
strategy.entry("Short", strategy.short, comment="Enter Short: Buy Put & Sell Call at ATM")
else
strategy.entry("Short", strategy.short, comment="Add Short: Buy Put & Sell Call at ATM")
hasExited := false // Reset exit flag
//──────────────────────────────
// **Updated Alert Conditions**
//──────────────────────────────
// Alerts for valid trade entries
alertcondition(bullSignal and (hasExited or newSession),
title="Long Entry Alert",
message="Bullish signal: BUY CALL & SELL PUT at ATM. Entry allowed.")
alertcondition(bearSignal and (hasExited or newSession),
title="Short Entry Alert",
message="Bearish signal: BUY PUT & SELL CALL at ATM. Entry allowed.")