سی ایم ایف مومنٹم بریکنگ چلتی اوسط حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-09-11 17:40:54
ٹیگز:

یہ حکمت عملی تجارتی سگنل بنانے کے لئے سی ایم ایف مومنٹم اشارے اور 200 دن کے ای ایم اے کو یکجا کرتی ہے۔

خاص طور پر ، سی ایم ایف مومنٹم پیسہ کے بہاؤ میں تبدیلی کی شرح کی عکاسی کرتا ہے۔ 0 کو اوپر جانا خریدنے کا اشارہ ہے ، اور 0 کو نیچے جانا فروخت کا اشارہ ہے۔ دریں اثنا ، صرف 200 دن کے ای ایم اے سے زیادہ لمبا ، اور اس سے کم مختصر۔

اسٹاپ نقصان 2 گنا اے ٹی آر پر مقرر کیا جاتا ہے۔ منافع حاصل کرنا 2 گنا اسٹاپ نقصان ہے ، جس سے 2: 1 منافع / نقصان کا تناسب حاصل ہوتا ہے۔

اس حکمت عملی کا فائدہ یہ ہے کہ مرکزی رجحان کے لئے ای ایم اے کے ساتھ مل کر فنڈز کے بہاؤ کی سمت کا فیصلہ کرنے کے لئے سی ایم ایف مومنٹم کا استعمال کیا جاتا ہے۔ منافع / نقصان کا تناسب مستحکم منافع حاصل کرنے میں مدد کرتا ہے۔ لیکن پسماندہ اشارے کی وجہ سے ، انٹری ٹائمنگ زیادہ سے زیادہ نہیں ہوسکتی ہے۔

مجموعی طور پر ، جب رجحانات واضح ہوتے ہیں تو سی ایم ایف مومنٹم بریک آؤٹ چلتی اوسط حکمت عملی بہتر کام کرتی ہے۔ لیکن غیر ضروری نقصانات سے بچنے کے ل live براہ راست تجارت میں سگنل اندراجات کے وقت پر ابھی بھی توجہ کی ضرورت ہے۔


/*backtest
start: 2023-08-11 00:00:00
end: 2023-09-10 00:00:00
period: 45m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// ***************************************************
// CMF Velocity with 200 EMA Strategy
// CMF Velocity Indicator by TheSadRhinoInvesting
// Author: TheSadRhinoInvesting, v1.0, 2021.05.16
//                   INITIAL RELEASE
// ***************************************************

//@version=4
strategy("CMF Velocity with 200EMA Strategy")

// ***************************************************
//              Strategy & Rules
// ***************************************************
// This strategy is a demonstration of my new Indicator: CMF Velocity
// CMF Velocity: https://www.tradingview.com/script/zsTl96Gd-CMF-Velocity/
// The strategy works best in a strongly trending market

// === Indicators ===
// EMA 
// @ 200
// CMF Velocity
// @ 11, 7
// ATR
// @ 10

// === Rules ===
// long only 
// - price above EMA200
// short only 
// - price below EMA200
// Stop Loss = 2x ATR
// Profit = 2x SL/risk (Profit Ratio x Max Loss)

// === Entries ===
// LONG
// - long entry (Typical): 
// - CMF Velocity crosses above 0

// SHORT
// - short entry (Typical): 
// - CMF Velocity crosses below 0

// ***************************************************
// Backtest Parameters
// ***************************************************
testStartYear = input(2021, "Backtest Start Year")
testStartMonth = input(5, "Backtest Start Month")
testStartDay = input(2, "Backtest Start Day")
testStartHour = input(0, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, testStartHour, 0)

testEndYear = input(2021, "Backtest End Year")
testEndMonth = input(5, "Backtest End Month")
testEndDay = input(16, "Backtest End Day")
testEndHour = input(0, "Backtest End Hour")
testPeriodEnd = timestamp(testEndYear, testEndMonth, testEndDay, testEndHour, 0)

timeBacktesting = true
direction = input(0, title = "Strategy Direction", type=input.integer, minval=-1, maxval=1)
strategy.risk.allow_entry_in(direction == 0 ? strategy.direction.all : (direction < 0 ? strategy.direction.short : strategy.direction.long))

// ***************************************************
// Inputs
// ***************************************************
// Profit/Loss Ratio
pLRatioMultiplier = input(2, title="Profit/Loss Multiplier", step=0.1, minval=0.1)

// EMA Period
emaPeriod = input(200, title="EMA Period", step=1, minval=1)
// ATR Multiplier
atrMultiplier = input(2, title="ATR Multiplier", step=0.1, minval=0.1)
// ATR Period
atrPeriod = input(10, title="ATR Period", step=1, minval=1)
// CMF Period
cmfPeriod = input(11, title="CMF Period", step=1, minval=1)
// CMF Velocity Period
cmfVelocityPeriod = input(7, title="CMF Velocity Period", step=1, minval=1)

// ***************************************************
// Indicator Functions
// ***************************************************
// CMF Function
cmf(period) =>
    moneyFlowMultiplier = (((close - low) - (high - close)) / (high - low)) * volume
    notNaMoneyFlowMultiplier = na(moneyFlowMultiplier) ? 0 : moneyFlowMultiplier
    moneyFlowAverage = sma(notNaMoneyFlowMultiplier, period)
    volumeAverage = sma(volume, period)
    moneyFlowAverage / volumeAverage

// CMF Velocity Function    
cmfVelocity(cmf, period) =>
    difference = change(cmf)
    sma(difference, period)
    
// ***************************************************
// Indicator Calculation and Plotting
// ***************************************************
cmfSeries = cmf(cmfPeriod)
cmfVelocitySeries = cmfVelocity(cmfSeries, cmfVelocityPeriod)
atrSeries = atr(atrPeriod)
triggerEMA = ema(close, emaPeriod)
plot(triggerEMA)    

// ***************************************************
// Strategy Execution
// ***************************************************
if (crossover(cmfVelocitySeries, 0.0) and triggerEMA < close and timeBacktesting)
    stopOffset = atrSeries * atrMultiplier
    profitOffset = stopOffset * pLRatioMultiplier
    stopLoss = close - stopOffset
    takeProfit = close + profitOffset
    strategy.entry("Long Entry", true)
    strategy.exit("Exit", "Long Entry", stop=stopLoss, limit=takeProfit)
    
if (crossunder(cmfVelocitySeries, 0.0) and triggerEMA > close and timeBacktesting)
    stopOffset = atrSeries * atrMultiplier
    profitOffset = stopOffset * pLRatioMultiplier
    stopLoss = close + stopOffset
    takeProfit = close - profitOffset
    strategy.entry("Short Entry", false)
    strategy.exit("Exit", "Short Entry", stop=stopLoss, limit=takeProfit)


مزید