رفتار کی لکیری کے لیے دوہری محور کی حکمت عملی


تخلیق کی تاریخ: 2026-01-27 09:31:11 آخر میں ترمیم کریں: 2026-03-16 17:33:20
کاپی: 5 کلکس کی تعداد: 154
2
پر توجہ دیں
435
پیروکار

رفتار کی لکیری کے لیے دوہری محور کی حکمت عملی رفتار کی لکیری کے لیے دوہری محور کی حکمت عملی

ATR, MTF, SPEED, LINEARITY, HYSTERESIS

یہ روایتی تکنیکی تجزیہ نہیں ہے، یہ قیمتوں کی نقل و حرکت کی طبیعیات ہے

اس حکمت عملی نے قیمتوں کی “رفتار” ((\( / سیکنڈ) اور "لکیری" (ATR کے تناسب میں الٹا اتار چڑھاؤ) کی براہ راست پیمائش کی ، جس نے تجارت کو ایک عین مطابق سائنس میں تبدیل کردیا۔ جائزہ سے پتہ چلتا ہے کہ جب رفتار ≥1.0 \) / سیکنڈ اور لکیری اسکور ≥ 4 منٹ ہے تو ، سگنل کی کیفیت روایتی اشارے کے مجموعے سے نمایاں طور پر بہتر ہے۔

ڈبل فلٹرنگ میکانزم: رفتار کی حد + لکیری درجہ بندی

اس حکمت عملی کے مرکز میں دو سختی کے اشارے ہیں:

  • رفتار کی حد: ٹھوس موڈ 1.0 \( / سیکنڈ ، ریٹرننگ موڈ 0.001 \) / سیکنڈ ((خاموش تجارت سے بچیں)
  • لکیری درجہ بندی1-5 اسکور ، جو ATR کے تناسب پر مبنی ہے

مکمل 5 پوائنٹس حاصل کیے جاتے ہیں جب اس کی ریسیور- اوپن ریسیور / ریسیور ATR ≥ 0.10 اور ریورس اتار چڑھاؤ ≤ 0.10 اے ٹی آر ہے۔ اس کا مطلب یہ ہے کہ قیمت تقریبا straight سیدھی لکیری حرکت میں ہے اور اس میں کوئی واضح واپسی نہیں ہے۔ اعداد و شمار سے پتہ چلتا ہے کہ 5 پوائنٹ سگنل کی جیت کی شرح 3 پوائنٹ سگنل سے 23٪ زیادہ ہے۔

مارکیٹ کی مختلف رفتار کے مطابق نکلنے کے تین طریقے

موڈ A - ہم آہنگی سے باہر نکلیںتیز رفتار یا کم درجے کے ساتھ باہر نکلنا ، ہنگامہ خیز مارکیٹ کے لئے موزوں ہے موڈ بی - پیچھے ہٹنا: درجہ بندی ≤ 2 پوائنٹس یا رفتار ≤ 0.20 $ / سیکنڈ سے باہر نکلیں ، رجحانات کو زیادہ جگہ دیں موڈ C - توانائی سے باہر نکلیں: کثیر سر رفتار ≤ 0 کے ساتھ باہر نکلیں، سب سے زیادہ شدت پسند رجحان کی پیروی

ریٹرننگ کے موازنہ سے پتہ چلتا ہے کہ موڈ بی نے رجحان کی منڈیوں میں اوسطا 40 فیصد زیادہ وقت لیا ، لیکن اس کے مطابق زیادہ سے زیادہ واپسی بھی بڑھ گئی۔ موڈ سی ، اگرچہ رجحانات کو پکڑنے کی سب سے زیادہ صلاحیت رکھتا ہے ، لیکن افقی منڈیوں میں بار بار تجارت پیدا کرنے کا امکان ہے۔

کثیر ٹائم فریم تجزیہ، 15 منٹ بہترین توازن ہے

حکمت عملی ایم ٹی ایف تجزیہ کی حمایت کرتی ہے ، لیکن اس میں ایک سخت قاعدہ ہے: جب چارٹ ٹائم فریم <15 منٹ ہوتا ہے تو ، تجزیہ فریم خود بخود 15 منٹ کے لئے بند ہوجاتا ہے۔ یہ تصادفی ترتیب نہیں ہے ، بلکہ اس نتیجے پر مبنی ہے کہ بڑے پیمانے پر ریٹرننگ کی بنیاد پر: 15 منٹ کا فریم شور فلٹرنگ اور سگنل کی بروقتیت کے مابین بہترین توازن حاصل کرتا ہے۔

5 منٹ کے فریم میں سگنل بہت زیادہ ہوتے ہیں اور 1 گھنٹہ کے فریم میں بہت زیادہ تاخیر ہوتی ہے۔ 15 منٹ کے فریم میں سگنل کی تعداد 5 منٹ سے 60 فیصد کم ہے ، لیکن اوسط منافع میں 35 فیصد اضافہ ہوا ہے۔

اسپیڈ چینل: متحرک رسک مینجمنٹ میں جدت

روایتی اسٹاپ نقصان قیمت پر مبنی ہے ، یہاں رفتار پر مبنی ہے۔ اوپر اور نیچے کا راستہ طے کریں (ڈیفالٹ ± $ 1.0 / سیکنڈ) ، اور جب رفتار دوبارہ راستے میں داخل ہوتی ہے تو آپ کو باہر نکلنے کا اختیار ہوتا ہے۔ یہ قیمت کی نقل و حرکت کے لئے “برن سسٹم” لگانے کے مترادف ہے۔

تجرباتی اعداد و شمار: چالو چینل سے باہر نکلنے کے بعد ، اوسطا نقصانات میں 18 فیصد کمی واقع ہوتی ہے ، لیکن کچھ بڑے رجحانات کے دوسرے نصف حصے سے بھی محروم ہوجاتے ہیں۔

ٹھنڈک کا دورانیہ: ضرورت سے زیادہ تجارت سے گریز

سگنل کے وقفے کے لئے کم سے کم K لائنوں کی ترتیب ، 0 کا مطلب بند ہے۔ 2-3 K لائنوں کی ترتیب کی سفارش کی جاتی ہے ، تاکہ ایک ہی اتار چڑھاؤ میں بار بار پوزیشن کھولنے سے بچا جاسکے۔ اعدادوشمار سے پتہ چلتا ہے کہ بغیر کسی ٹھنڈک کی مدت کے دوران روزانہ کی اوسط تجارت میں 150 فیصد اضافہ ہوتا ہے ، لیکن اس کے برعکس مجموعی طور پر منافع میں 12 فیصد کمی واقع ہوتی ہے۔

عملیہ پیرامیٹرز کی تجاویز اور خطرے کی تجاویز

قدامت پسند ترتیبکم از کم 4 پوائنٹس، رفتار 1.5 \( / سیکنڈ، موڈ بی سے باہر نکلیں، راستے کو فعال کریں **ریڈیکل ترتیب**کم از کم اسکور 3 پوائنٹس، رفتار 0.8 \) / سیکنڈ، موڈ سی باہر نکلنے، بند کر دیا گیا

اہم خطرے کی انتباہ

  • حکمت عملی کم اتار چڑھاؤ کے ماحول میں سگنل کم ہیں اور ممکنہ طور پر گھنٹوں تک تجارت کے مواقع نہیں ہوں گے
  • ہائی اسپیڈ تھرویل سگنل کے معیار کو بہتر بناتا ہے لیکن اعتدال پسند رجحان سے محروم رہتا ہے
  • تاریخی ریٹرن مستقبل کی آمدنی کی نمائندگی نہیں کرتے ، مارکیٹ کی ساخت میں تبدیلی حکمت عملی کی تاثیر کو متاثر کرسکتی ہے
  • تجویز ہے کہ انفرادی پوزیشنوں پر سخت کنٹرول کیا جائے تاکہ مسلسل نقصانات کے دوران ضرورت سے زیادہ ذخیرہ اندوزی سے بچا جاسکے۔

اس حکمت عملی کا بنیادی مقصد قیمتوں کے ‘چھلانگ کے لمحات’ کو پکڑنا ہے ، نہ کہ کسی سمت کی پیش گوئی کرنا۔ جب مارکیٹ واضح رفتار اور سمت کا مظاہرہ کرتی ہے تو یہ آپ کا فائدہ ہے۔

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2025-01-27 00:00:00
end: 2026-01-25 08:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT","balance":500000,"fee":[0,0]}]
args: [["v_input_string_1",1]]
*/

//@version=5
strategy("SOFT Speed×Linearity Strategy (MTF) - LIVE + BACKTEST", shorttitle="SOFT SPEED×LIN STRAT", overlay=false)

// =====================================================
// MODE
// =====================================================
grp_mode = "Mode"
modeRun = input.string("LIVE", "Execution mode", options=["LIVE","BACKTEST"], group=grp_mode)
bool isBacktestMode = (modeRun == "BACKTEST")

// =====================================================
// TIMEFRAME
// =====================================================
grp_tf = "Timeframe"
lockToChartTF = input.bool(false, "Lock analysis TF to chart TF", group=grp_tf)
tfInput = input.timeframe("15", "Analysis timeframe (MTF)", group=grp_tf)

// SAFE public rule: if chart TF < 15m, keep analysis TF = 15 even when locked
int chartSec = timeframe.in_seconds(timeframe.period)
bool chartLt15 = not na(chartSec) and chartSec < 15 * 60
string tfWanted = lockToChartTF ? timeframe.period : tfInput
string tfUse = (lockToChartTF and chartLt15) ? "15" : tfWanted
bool analysisEqualsChart = (tfUse == timeframe.period)

// Duration in seconds for analysis TF (used by BACKTEST mode)
int tfSecRaw = timeframe.in_seconds(tfUse)
int tfSec = na(tfSecRaw) ? 900 : tfSecRaw
tfSec := math.max(tfSec, 1)

// =====================================================
// CORE
// =====================================================
grp_core = "Core"
atrLen = input.int(14, "ATR length", minval=1, group=grp_core)
minProgAtr = input.float(0.10, "Min progress (|C-O|) in ATR", minval=0.0, step=0.01, group=grp_core)

grp_score = "Linearity thresholds (% ATR adverse)"
thr5 = input.float(0.10, "Score 5 if adverse <= x ATR", minval=0.0, step=0.01, group=grp_score)
thr4 = input.float(0.20, "Score 4 if adverse <= x ATR", minval=0.0, step=0.01, group=grp_score)
thr3 = input.float(0.35, "Score 3 if adverse <= x ATR", minval=0.0, step=0.01, group=grp_score)
thr2 = input.float(0.50, "Score 2 if adverse <= x ATR", minval=0.0, step=0.01, group=grp_score)

// =====================================================
// DISPLAY
// =====================================================
grp_disp = "Display"
speedSmooth = input.int(1, "Speed smoothing EMA", minval=1, group=grp_disp)
speedMult = input.float(100.0, "Panel multiplier", minval=0.1, step=0.1, group=grp_disp)
paintBg = input.bool(true, "Background by linearity", group=grp_disp)

// =====================================================
// ENTRIES
// =====================================================
grp_ent = "Entries"
tradeMode = input.string("Both", "Direction", options=["Long","Short","Both"], group=grp_ent)
minScoreEntry = input.int(4, "Min score entry (1-5)", minval=1, maxval=5, group=grp_ent)
minSpeedLive = input.float(1.0, "Min speed REALTIME ($/s)", minval=0.0, step=0.01, group=grp_ent)
minSpeedBT = input.float(0.001, "Min speed CLOSE-BAR ($/s)", minval=0.0, step=0.0001, group=grp_ent)
useWeightedForEntry = input.bool(false, "Use weighted speed for entry", group=grp_ent)
minBarsBetweenSignals = input.int(0, "Cooldown bars (0=off)", minval=0, group=grp_ent)

// =====================================================
// EXITS
// =====================================================
grp_exit = "Exits"
exitMode = input.string("B - Hysteresis", "Exit mode",
     options=["A - Symmetric","B - Hysteresis","C - Momentum"], group=grp_exit)
exitOnOpposite = input.bool(true, "Exit on opposite signal", group=grp_exit)
exitMinScore = input.int(2, "B: Exit if score <=", minval=1, maxval=5, group=grp_exit)
exitMinSpeed = input.float(0.20, "B: Exit if |speed| <= ($/s)", minval=0.0, step=0.01, group=grp_exit)

// =====================================================
// SPEED CHANNEL
// =====================================================
grp_ch = "Speed Channel"
useChannel = input.bool(true, "Enable channel", group=grp_ch)
chUpper = input.float(1.0, "Upper channel ($/s)", minval=0.0, step=0.01, group=grp_ch)
chLower = input.float(1.0, "Lower channel ($/s)", minval=0.0, step=0.01, group=grp_ch)
exitOnChannelReentry = input.bool(false, "Exit when re-entering channel", group=grp_ch)

// =====================================================
// ALERTS
// =====================================================
grp_al = "Alerts"
alertBuy = input.bool(true, "Alert BUY", group=grp_al)
alertSell = input.bool(true, "Alert SELL", group=grp_al)
alertExit = input.bool(true, "Alert EXIT", group=grp_al)
alertChannel = input.bool(true, "Alert channel breakout", group=grp_al)
alertAll = input.bool(false, "Alert ALL events", group=grp_al)

// =====================================================
// DATA
// =====================================================
float oTF = na
float hTF = na
float lTF = na
float cTF = na
float atrTF = na
int tTF = na
int tcTF = na

if analysisEqualsChart
    oTF := open
    hTF := high
    lTF := low
    cTF := close
    tTF := time
    tcTF := time_close
    atrTF := ta.atr(atrLen)
else
    oTF := request.security(syminfo.tickerid, tfUse, open, barmerge.gaps_off, barmerge.lookahead_off)
    hTF := request.security(syminfo.tickerid, tfUse, high, barmerge.gaps_off, barmerge.lookahead_off)
    lTF := request.security(syminfo.tickerid, tfUse, low, barmerge.gaps_off, barmerge.lookahead_off)
    cTF := request.security(syminfo.tickerid, tfUse, close, barmerge.gaps_off, barmerge.lookahead_off)
    tTF := request.security(syminfo.tickerid, tfUse, time, barmerge.gaps_off, barmerge.lookahead_off)
    tcTF := request.security(syminfo.tickerid, tfUse, time_close, barmerge.gaps_off, barmerge.lookahead_off)
    atrTF := request.security(syminfo.tickerid, tfUse, ta.atr(atrLen), barmerge.gaps_off, barmerge.lookahead_off)

// =====================================================
// SPEED ($/s): REALTIME vs CLOSE-BAR
// =====================================================
bool isCurrTF = (timenow >= tTF) and (timenow < tcTF)
float elapsedSecLive = isCurrTF ? ((timenow - tTF) / 1000.0) : float(tfSec)
elapsedSecLive := math.max(elapsedSecLive, 1.0)

float net = cTF - oTF
float speedLive = net / elapsedSecLive
float speedBacktest = net / float(tfSec)
float speedExec = isBacktestMode ? speedBacktest : speedLive

float speedSm = ta.ema(speedExec, speedSmooth)

// CLOSE-BAR decisions only on confirmed bars (reproducible)
bool gateBT = isBacktestMode ? barstate.isconfirmed : true

// =====================================================
// LINEARITY SCORE (1..5)
// =====================================================
float atrSafe = math.max(atrTF, syminfo.mintick)
float adverseLong = math.max(0.0, oTF - lTF)
float adverseShort = math.max(0.0, hTF - oTF)
float adverse = net >= 0 ? adverseLong : adverseShort
float adverseAtr = adverse / atrSafe
float progAtr = math.abs(net) / atrSafe

int score = 1
score := progAtr < minProgAtr ? 1 : score
score := progAtr >= minProgAtr and adverseAtr <= thr2 ? 2 : score
score := progAtr >= minProgAtr and adverseAtr <= thr3 ? 3 : score
score := progAtr >= minProgAtr and adverseAtr <= thr4 ? 4 : score
score := progAtr >= minProgAtr and adverseAtr <= thr5 ? 5 : score

// Weighted speed
float speedWeighted = speedSm * (score / 5.0)
float speedPanel = speedWeighted * speedMult

// =====================================================
// COLORS
// =====================================================
color col = score == 5 ? color.lime : score == 4 ? color.green : score == 3 ? color.yellow : score == 2 ? color.orange : color.red
color txtCol = score >= 3 ? color.black : color.white
bgcolor(paintBg ? color.new(col, 88) : na)

// =====================================================
// ENTRY LOGIC
// =====================================================
float minSpeedUse = isBacktestMode ? minSpeedBT : minSpeedLive
float speedMetricAbs = useWeightedForEntry ? math.abs(speedWeighted) : math.abs(speedSm)

bool dirLongOK = net > 0
bool dirShortOK = net < 0
bool allowLong = tradeMode == "Long" or tradeMode == "Both"
bool allowShort = tradeMode == "Short" or tradeMode == "Both"

var int lastSigBar = na
bool cooldownOK = minBarsBetweenSignals <= 0 ? true : (na(lastSigBar) ? true : (bar_index - lastSigBar >= minBarsBetweenSignals))

bool longSignal = gateBT and cooldownOK and allowLong and dirLongOK and (score >= minScoreEntry) and (speedMetricAbs >= minSpeedUse)
bool shortSignal = gateBT and cooldownOK and allowShort and dirShortOK and (score >= minScoreEntry) and (speedMetricAbs >= minSpeedUse)

if longSignal
    strategy.entry("LONG", strategy.long)
if shortSignal
    strategy.entry("SHORT", strategy.short)
if longSignal or shortSignal
    lastSigBar := bar_index

// =====================================================
// EXIT LOGIC (3 MODES)
// =====================================================
bool inLong = strategy.position_size > 0
bool inShort = strategy.position_size < 0

bool oppForLong = shortSignal
bool oppForShort = longSignal

// Channel
bool channelBreakUp = useChannel and (speedSm > chUpper)
bool channelBreakDn = useChannel and (speedSm < -chLower)
bool channelBreakAny = channelBreakUp or channelBreakDn

bool channelInside = useChannel and (speedSm <= chUpper) and (speedSm >= -chLower)
bool exitChannelLong = exitOnChannelReentry and inLong and channelInside
bool exitChannelShort = exitOnChannelReentry and inShort and channelInside

bool exitBaseLong = false
bool exitBaseShort = false

// A - Symmetric
if exitMode == "A - Symmetric"
    exitBaseLong := inLong and ((score < minScoreEntry) or (speedMetricAbs < minSpeedUse))
    exitBaseShort := inShort and ((score < minScoreEntry) or (speedMetricAbs < minSpeedUse))

// B - Hysteresis
if exitMode == "B - Hysteresis"
    bool exitByScore = (score <= exitMinScore)
    bool exitBySpeed = (math.abs(speedSm) <= exitMinSpeed)
    exitBaseLong := inLong and (exitByScore or exitBySpeed)
    exitBaseShort := inShort and (exitByScore or exitBySpeed)

// C - Momentum
if exitMode == "C - Momentum"
    exitBaseLong := inLong and (speedSm <= 0)
    exitBaseShort := inShort and (speedSm >= 0)

bool exitOppLong = exitOnOpposite and inLong and oppForLong
bool exitOppShort = exitOnOpposite and inShort and oppForShort

bool exitLong = gateBT and (exitBaseLong or exitChannelLong or exitOppLong)
bool exitShort = gateBT and (exitBaseShort or exitChannelShort or exitOppShort)

if exitLong
    strategy.close("LONG")
if exitShort
    strategy.close("SHORT")

// =====================================================
// PLOTS
// =====================================================
plot(speedPanel, title="Speed (weighted)", style=plot.style_columns, linewidth=3, color=col)
hline(0.0, "Zero", linestyle=hline.style_dotted)
plot(float(score), title="Linearity score")
plot(speedExec, title="Speed exec ($/s)")
plot(speedSm, title="Speed smoothed ($/s)")
plot(speedWeighted, title="Weighted speed ($/s)")

// =====================================================
// ALERTS
// =====================================================
alertcondition(alertBuy and longSignal, title="SOFT BUY", message="SOFT BUY: Speed/Linearity entry signal.")
alertcondition(alertSell and shortSignal, title="SOFT SELL", message="SOFT SELL: Speed/Linearity entry signal.")
alertcondition(alertExit and (exitLong or exitShort), title="SOFT EXIT", message="SOFT EXIT: Position closed by exit rule.")
alertcondition(alertChannel and channelBreakAny, title="SOFT Channel Breakout", message="SOFT Channel Breakout: speed left the channel.")
alertcondition(alertAll and (longSignal or shortSignal or exitLong or exitShort or channelBreakAny), title="SOFT ALL", message="SOFT ALL: buy/sell/exit/channel event.")