رفتار کی تبدیلی کی تجارتی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-10-07 16:52:05
ٹیگز:

جائزہ

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

تجارتی منطق

حکمت عملی میں موجودہ رجحان کی سمت کا تعین کرنے کے لئے تین اشارے کے طور پر آر ایس آئی ، اسٹاک اور ایم اے سی ڈی کا استعمال کیا گیا ہے۔ مخصوص منطق یہ ہے:

  • آر ایس آئی ((7): 50 سے اوپر آر ایس آئی ایک اپ ٹرینڈ کی نشاندہی کرتا ہے ، جبکہ 50 سے نیچے ایک ڈاؤن ٹرینڈ
  • اسٹاک ((%K، 14، 3، 3): 50 سے اوپر %K اوپر کا رجحان ہے، 50 سے نیچے کا رجحان ہے
  • MACD ((12، 26، 9): MACD اوپر سگنل لائن اپ ٹرینڈ ہے، نیچے ڈاؤن ٹرینڈ ہے

جب تینوں اشارے تیزی سے بڑھتے ہیں تو ، بار کا رنگ سبز ہوجاتا ہے۔ جب سب bearish ہوتے ہیں تو ، بار کا رنگ سرخ ہوجاتا ہے۔ اگر اشارے کے مابین اختلاف ہے تو ، بار کا رنگ سیاہ ہوجاتا ہے۔

تجارتی قوانین یہ ہیں:

  • جب موجودہ بار سبز ہے، اور پچھلی بار سیاہ یا سرخ ہے، تو طویل عرصے تک جائیں. داخلہ کی قیمت 0.01 بار کے سب سے اوپر ہے.
  • جب موجودہ بار سرخ ہے ، اور پچھلی بار سیاہ یا سبز ہے ، مختصر ہوجائیں۔ اندراج کی قیمت 0.01 بار کی کم سے کم ہے۔
  • اگر لانگ پوزیشن کے دوران بار سرخ یا سیاہ ہو جائے تو لانگ ٹریڈ بند کریں۔
  • اگر شارٹ پوزیشن کے دوران بار سبز یا سیاہ ہو جائے تو شارٹ ٹریڈ بند کر دیں۔

اس حکمت عملی میں اسٹاپ نقصان اور منافع حاصل کرنے کے لئے اے ٹی آر (7) بھی استعمال کیا جاتا ہے۔ اسٹاپ نقصان 1.5 گنا اے ٹی آر پر مقرر کیا جاتا ہے ، اور منافع حاصل کرنے کے لئے 3 گنا اے ٹی آر۔

فوائد کا تجزیہ

اس حکمت عملی کے فوائد میں شامل ہیں:

  1. رجحان کا تعین کرنے کے لئے متعدد اشارے کا استعمال کرتے ہوئے غلط بریکآؤٹس کو مؤثر طریقے سے فلٹر کیا جاسکتا ہے۔ جب آر ایس آئی ، اسٹاک اور ایم اے سی ڈی سبھی اتفاق کرتے ہیں تو رجحان کی تبدیلی کا امکان زیادہ ہوتا ہے۔

  2. اے ٹی آر اسٹاپ نقصان اور منافع حاصل کرنے کی ترتیبات معقول ہیں۔ اے ٹی آر مارکیٹ کی اتار چڑھاؤ کو مؤثر طریقے سے ٹریک کرسکتا ہے۔ اے ٹی آر کے ضربوں کا استعمال کرکے ، اسٹاپ اور اہداف کو مارکیٹ کے حالات کی بنیاد پر متحرک طور پر ایڈجسٹ کیا جاسکتا ہے۔

  3. سادہ اور واضح منطق، سمجھنے اور خودکار کرنے میں آسان۔ خودکار تجارتی حکمت عملی کے طور پر موزوں ہے۔

خطرے کا تجزیہ

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

  1. انفرادی اشارے میں غلطیاں اندراج کے وقت کو متاثر کرسکتی ہیں۔ غلطیوں کو کم کرنے کے لئے پیرامیٹرز کو ایڈجسٹ کرنے یا مزید تصدیق کے اشارے شامل کرنے پر غور کیا جاسکتا ہے۔

  2. اے ٹی آر کا سائز رکنے اور اہداف کو نمایاں طور پر متاثر کرتا ہے۔ اے ٹی آر کے غلط حساب سے رکنے کی وجہ سے بہت وسیع یا اہداف بہت تنگ ہوسکتے ہیں۔ اے ٹی آر کی تصدیق کے لئے اضافی اشارے شامل کرسکتے ہیں۔

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

  4. اوور فٹنگ کا خطرہ۔ پیرامیٹرز اور قواعد کی استحکام کی تصدیق کے لئے مکمل بیک ٹسٹنگ کی ضرورت ہے۔

بہتری کی ہدایات

اس حکمت عملی میں ممکنہ بہتری:

  1. ریورس پوائنٹس کا تعین کرنے میں درستگی کو بہتر بنانے کے لئے اشارے کو ایڈجسٹ کرنا یا شامل کرنا۔ مثال کے طور پر زیادہ خرید / زیادہ فروخت کی سطح کی جانچ پڑتال کے لئے بولنگر بینڈ شامل کرنا۔

  2. اتار چڑھاؤ کو بہتر طریقے سے ٹریک کرنے کے لئے اے ٹی آر حساب کتاب کو بہتر بنانا۔ مثال کے طور پر اے ٹی آر / قیمت کے تناسب کا استعمال کرتے ہوئے۔

  3. رجحانات کے اشارے شامل کرنا تاکہ مارکیٹوں کے دوران وِپساؤ سے بچا جاسکے۔ مثال کے طور پر چلتے ہوئے اوسط۔

  4. پیسے کے انتظام کو بہتر بنانا، جیسے ڈراؤنڈ کی بنیاد پر پوزیشن سائزنگ کو ایڈجسٹ کرنا۔

  5. وقت کے فریموں میں استحکام کی جانچ کرنے کے لئے مدت کی اصلاح.

  6. قابل اعتماد کی تصدیق کے لیے مختلف مصنوعات اور وقت کی مدت پر مزید بیک ٹسٹنگ۔

خلاصہ

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


/*backtest
start: 2023-09-06 00:00:00
end: 2023-10-06 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jwitt98
//The PowerX strategy - based on the rules outlined in the book "The PowerX Strategy: How to Trade Stocks and Options in Only 15 Minutes a Day" by Markus Heitkoetter

//@version=5
strategy("PowerX", overlay=true)
strategy.initial_capital = 50000
longEntry = "Enter long"
shortEntry = "Enter short"
longExit = "Exit long"
shortExit = "Exit short"

//*********************************Begin inputs*********************************

//get time range inputs and set time range bool
timeRangeGroup = "Select the trading range"
startDate = input(timestamp("1 Jan 2021 00:00 +0000"), "Start date", "Select the start date for the trading range", "", timeRangeGroup)
endDate = input(timestamp("1 Jan 2050 00:00 +0000"), "End date", "Select the end date for the trading range", "", timeRangeGroup)
isInTimeRange = true

//get long/short inputs
positionsAllowedGroup = "Select the direction(s) of trades to allow"
isLongsAllowed = input.bool(true, "Allow long positions", "Check the box if you want to allow long positions", "", positionsAllowedGroup)
isShortsAllowed = input.bool(true, "Allow short positions", "Check the box if you want to allow short positions", "", positionsAllowedGroup)

//get the stop loss and profit target multiples.  Per the PowerX rules the ratio shoud be 1:2.  1.5 and 3 are defaults
adrMultuplesGroup="Select the multipliers for the stop loss and profit targets"
stopLossMultiple = input.float(1.5, "Stop loss multiple", 0.1, 10, 0.1, "The ADR is multiplied by the stop loss multiple to calculate the stop loss", group=adrMultuplesGroup)
profitTargetMultiple=input.float(3.0, "Profit target multiple", 0.1, 10, 0.1, "The ADR is multiplied by the profit target multiple to calculate the profit target", group=adrMultuplesGroup)

//get the option to use the money management stategy or not.  This is a fixed ratio type management system
moneyManagementGroup="Money management"
isUsingMoneyManagement=input.bool(false, "Use money management", "Check the box if you want to use a fixed ratio type money management system, such as the type described in PowerX", group=moneyManagementGroup)
initial_riskPercent=input.float(2.0, "Percent risk per trade", .1, 100, .1, "The percentage of capital you want to risk when starting out.  This will increase or decrease base on the money management rules.  Only applicable if money managent is used", group=moneyManagementGroup)/100
isRiskDowsideLimited=input.bool(false, "Keep risk at or above the set point", "Check the box if you don't want the risk to fall below the set \"risk per trade\" percentage, for example, when your equity is underwater. Only applicable if money management is used", "", moneyManagementGroup)
initial_riskPerTrade=initial_riskPercent * strategy.initial_capital 
riskFactor = 0.0
currentProfit = 0.0
currentRisk = 0.0

//*********************************End inputs*********************************

//*********************************Begin money management*********************************

if(isUsingMoneyManagement)
    currentProfit := strategy.equity - strategy.initial_capital
    if(currentProfit < 0)
        currentProfit:=math.abs(currentProfit)
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := 1/riskFactor * initial_riskPercent * strategy.initial_capital
        if(isRiskDowsideLimited)
            currentRisk := initial_riskPerTrade
    else
        riskFactor := 0.5*(math.pow(1+8*currentProfit/(2*initial_riskPerTrade), 0.5)+1)
        currentRisk := riskFactor * initial_riskPercent * strategy.initial_capital
        
plot(strategy.equity, "Strategy equity")
plot(currentRisk, "Current risk")
plot(riskFactor, "Risk Factor")

//*********************************End money management*********************************


//*********************************Begin indicators*********************************
//4 indicators are used in this strategy, RSI(7), Stochastics(14, 3, 3), MACD(12, 26, 9), and ADR(7)

rsiVal = ta.rsi(close, 7)//this checks out
plot(rsiVal, "RSI(7)", color.lime)

stochKVal = ta.sma(ta.sma(ta.stoch(close, high, low, 14),3),3)//this formula checks out
plot(stochKVal, "Stoch %K", color.lime)

[macdLine, signalLine, histLine] = ta.macd(close, 12, 26, 9)
plot(histLine, "MACD Hist", color.lime)

adr = ta.sma(high, 7) - ta.sma(low, 7)
plot(adr, "Average daily range", color.orange)


//*********************************End indicators*********************************

//*********************************Define the bar colors*********************************

greenBar = rsiVal > 50 and stochKVal > 50 and histLine > 0
redBar = rsiVal < 50 and stochKVal < 50 and histLine < 0
blackBar = not greenBar and not redBar

color currentBarColor = switch
    greenBar => color.green
    redBar => color.red
    blackBar => color.gray //because black is too hard to see in dark mmode
    => color.yellow
    
barcolor(currentBarColor)

//*********************************End defining the bar colors*********************************

//*********************************Define the entry, stop loss and profit target*********************************

longStopLimit = high + .01
longProfitTarget = high + (profitTargetMultiple * adr)
longStopLoss = high - (stopLossMultiple * adr)

shortStopLimit = low - .01
shortProfitTarget = low - (profitTargetMultiple * adr)
shortStopLoss = low + (stopLossMultiple * adr)

qtyToTrade= math.floor(currentRisk / (stopLossMultiple * adr))//only if using money management
if(qtyToTrade * high > strategy.equity)
    qtyToTrade := math.floor(strategy.equity / high)

//*********************************End defining stop loss and profit targets*********************************

//*********************************Execute trades, set rules, stop loss and profit targets*********************************

if (greenBar and not greenBar[1] and isInTimeRange and isLongsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(longEntry, strategy.long, qtyToTrade, limit=longStopLimit, stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, qtyToTrade, stop=longStopLimit)
    else
        strategy.order(longEntry, strategy.long, limit=longStopLimit,stop=longStopLimit)
        //strategy.order(longEntry, strategy.long, stop=longStopLimit)
    strategy.exit("Long limit/stop", from_entry=longEntry, limit=longProfitTarget, stop=longStopLoss)
    

if(blackBar or redBar)
    strategy.cancel(longEntry)
    strategy.close(longEntry, longExit)
    

if (redBar and not redBar[1] and isInTimeRange and isShortsAllowed)
    if(isUsingMoneyManagement)
        strategy.order(shortEntry, strategy.short, qtyToTrade, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, qtyToTrade, stop=shortStopLimit)
    else
        strategy.order(shortEntry, strategy.short, limit=shortStopLimit, stop=shortStopLimit)
        //strategy.order(shortEntry, strategy.short, stop=shortStopLimit)
    strategy.exit("Short limit/stop", from_entry=shortEntry, limit=shortProfitTarget, stop=shortStopLoss)

if(blackBar or greenBar)
    strategy.cancel(shortEntry)
    strategy.close(shortEntry, shortExit)
    

//*********************************End execute trades, set rules, stop loss and profit targets*********************************






















مزید