متحرک حکمت عملی تجزیہ کا آلہ

مصنف:چاؤ ژانگ، تاریخ: 2023-10-13 15:54:35
ٹیگز:

جائزہ

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

حکمت عملی منطق

  1. حساب کی مدت کے آغاز اور اختتام کا وقت مقرر کریں.

  2. اعداد و شمار کی درستگی اور ہر گروپ میں ہفتوں کی تعداد مقرر کریں.

  3. داخلہ اور باہر نکلنے کے لئے RSI حکمت عملی کا مظاہرہ.

  4. اعداد و شمار کی میز کے لئے متغیرات کی وضاحت کریں.

  5. موجودہ مدت کے لئے نتیجہ کا حساب لگائیں.

  6. اگر دورانیہ بدلتا ہے اور تجارت فعال ہے تو اس دورانیے کا وقت اور نتیجہ درج کریں۔

  7. اگر یہ آخری بار ہے اور ٹریڈنگ فعال ہے تو، موجودہ مدت کے لئے وقت اور نتیجہ ریکارڈ کریں.

  8. اگر مدت بدل جائے اور تجارت غیر فعال ہو جائے تو پچھلی مدت کا وقت اور نتیجہ درج کریں۔

  9. سب سے زیادہ اور کم مدت کے نتائج تلاش کریں.

  10. اعداد و شمار کی میز پیش کریں۔

  • پہلے شماریاتی ادوار کی کل تعداد کا حساب لگائیں

  • ہر مدت کے ذریعے تکرار، ہیڈر، وقت اور نتائج فراہم

  • مجموعی طور پر ہر گروپ کے لئے نتیجہ کا حساب لگائیں

  • رنگین کوڈ مثبت اور منفی نتائج

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

  • فوری حکمت عملی کا جائزہ لینے کے لئے حقیقی وقت میں ہفتہ وار نتائج کا مشاہدہ کر سکتے ہیں

  • واضح بصیرت کے لئے نتائج کی بدیہی پیشکش

  • حکمت عملی کو ایڈجسٹ کرنے کے لئے ناقص کارکردگی کے ادوار کی نشاندہی میں مدد

  • طویل مدتی حکمت عملیوں کے لئے مجموعی فوائد کی نگرانی کے لئے آسان

  • مختلف وقت کے ادوار میں تجارت کے انداز کا موازنہ کر سکتا ہے

  • مختلف ضروریات کو پورا کرنے کے لئے حسب ضرورت صحت سے متعلق اور گروپ

  • سادہ اور واضح کوڈ، سمجھنے اور بڑھانے کے لئے آسان

خطرے کا تجزیہ

  • یہ حکمت عملی RSI پر مبنی ہے جس میں حدود کے بعد اندرونی رجحان ہے

  • تجارتی اخراجات اصل نتائج کو نمایاں طور پر متاثر کرسکتے ہیں

  • بیک ٹسٹ کے اعداد و شمار میں مارکیٹ کے اصل حالات کی عکاسی نہیں ہوسکتی ہے

  • بیک ٹسٹ میں ڈیفالٹ کیپٹل حقیقی اکاؤنٹ کے سائز سے مماثل نہیں ہوسکتا ہے

  • اعداد و شمار کی بنیاد پر پیرامیٹرز کو اندھے طور پر ایڈجسٹ کرکے اوور فٹنگ سے بچیں

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

اصلاح کی ہدایات

  • نیچے کی طرف محدود کرنے کے لئے سٹاپ نقصان شامل کرنے پر غور کریں

  • RSI پیرامیٹرز کو بہتر بنائیں جیسے زیادہ خریدنے اور زیادہ فروخت کی سطح

  • مختلف ٹریڈنگ تعدد کی کوشش کریں جیسے اندرونی دن بمقابلہ ماہانہ ہولڈنگ

  • رجحان اور وقت کے لئے مزید اشارے شامل کریں

  • منافع لینے کی منطق شامل کریں

  • اعداد و شمار پیرامیٹر کی ترتیبات کو بہتر بنائیں

  • متعدد اثاثوں کو ٹریک کرنے کے لئے توسیع کریں

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

خلاصہ

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


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

//@version=5
// strategy('Strategy weekly results as numbers v1', overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=25, commission_type=strategy.commission.percent, commission_value=0.04)

after = input(title='Trade after', defval=timestamp('01 Jan 2019 00:00 UTC'), tooltip="Strategy will be executed after this timestamp. The statistic table will include only periods after this date.")
before = input(title='Trade before', defval=timestamp('31 Dec 2024 23:59 UTC'), tooltip="Strategy will be executes before this timestamp. The statistic table will include only periods before this date.")

statisticPrecision = input.int(title='Statistic precision', group='Statistic visualisation', defval=1, tooltip="Defines how many digits should be rendered in every statistic cell.")
statisticGroupSize = input.int(title='Statistic group size', group='Statistic visualisation', defval=12, tooltip="Defines how many cells should be in one group inside the statistic table.")

// determinet whether the starategy should be traded between the period
isTradeEnabled = true


// *******************************************************************************************
// Core strategy simulation logic
// *******************************************************************************************
// calculate rsi strategy emulation data
rsiEmulationData = ta.rsi(close, 7)
rsiEmulationCrossover = ta.crossover(rsiEmulationData, 70)
rsiEmulationCrossunder = ta.crossunder(rsiEmulationData, 30)

// entry loogic based on the rsi calculations
if (isTradeEnabled and rsiEmulationCrossover)
    strategy.entry('Long', strategy.long)
if (isTradeEnabled and rsiEmulationCrossunder)
    strategy.entry('Short', strategy.short)


// *******************************************************************************************
// Weekly statistics table
// *******************************************************************************************
// define statistic variables
var statisticTable = table(na)
var statisticPeriodTime = array.new_int(0)
var statisticPeriodResult = array.new_float(0)
var statisticIsLatestCalculated = bool(na)
var statisticResultHighest = float(na)
var statisticResultLowest = float(na)
var statisticColorGray = color.new(color.gray, transp = 60)
var statisticColorGreen = color.new(color.green, transp = 60)
var statisticColorRed = color.new(color.red, transp = 60)

// claculate current period result
barResult = not na(strategy.equity[1])
             ? (strategy.equity / strategy.equity[1] - 1) : 0
isPeriodChanged = not na(time[1]) and weekofyear(time) != weekofyear(time[1])
currentPeriodResult = 0.0
currentPeriodResult := not na(currentPeriodResult[1]) and not isPeriodChanged
                       ? ((1 + currentPeriodResult[1]) * (1 + barResult) - 1) : 0.0

// initialise highest and lowest results variables
statisticResultHighest := na(statisticResultHighest) ? currentPeriodResult : statisticResultHighest
statisticResultLowest := na(statisticResultLowest) ? currentPeriodResult : statisticResultLowest

// search for highest and lowest results
statisticResultHighest := currentPeriodResult > statisticResultHighest ? currentPeriodResult : statisticResultHighest
statisticResultLowest := currentPeriodResult < statisticResultLowest ? currentPeriodResult : statisticResultLowest

// new week while trade is active
if isPeriodChanged and isTradeEnabled
    timeCalculated = time - 1000 * 60 * 60 * 24 * 7
    resultCalculated = currentPeriodResult[1]
    statisticIsLatestCalculated := false

    array.push(statisticPeriodTime, timeCalculated)
    array.push(statisticPeriodResult, resultCalculated)

// latest bar while trade is active
if barstate.islast and isTradeEnabled
    timeCalculated = time - 1000 * 60 * 60 * 24 * (dayofweek(time) - 2)
    resultCalculated = currentPeriodResult

    array.push(statisticPeriodTime, timeCalculated)
    array.push(statisticPeriodResult, resultCalculated)

// new week after trade disabled
if isPeriodChanged and not isTradeEnabled and not na(statisticIsLatestCalculated) and not statisticIsLatestCalculated
    timeCalculated = time - 1000 * 60 * 60 * 24 * (dayofweek(time) + 5)
    resultCalculated = currentPeriodResult[1]
    statisticIsLatestCalculated := true

    array.push(statisticPeriodTime, timeCalculated)
    array.push(statisticPeriodResult, resultCalculated)

// render statistics table
if barstate.islast
    statisticLength = array.size(statisticPeriodResult)
    statisticTableSteps = math.floor(statisticLength / statisticGroupSize) + (statisticLength % statisticGroupSize != 0 ? 1 : 0)
    statisticTable := table.new(position.bottom_right, columns = statisticGroupSize + 2, rows = statisticTableSteps + 1, border_width = 1)

    // render headers
    for i = 0 to (statisticGroupSize - 1)
        statisticHeaderContent = str.tostring(i + 1)
        table.cell(statisticTable, 1 + i, 0, statisticHeaderContent, bgcolor = statisticColorGray)

    // render time points
    for i = 0 to (statisticTableSteps - 1)
        statisticPointContent = str.format("{0,date,medium}", array.get(statisticPeriodTime, i * statisticGroupSize))
        table.cell(statisticTable, 0, 1 + i, statisticPointContent, bgcolor = statisticColorGray)

    // render the result
    statisticResultCummulative = 0.0
    for i = 0 to (array.size(statisticPeriodTime) - 1)
        statisticColumn = 1 + i % statisticGroupSize
        statisticRow = 1 + math.floor(i / statisticGroupSize)

        statisticResult = array.get(statisticPeriodResult, i)
        statisticResultCummulative := (i % statisticGroupSize == 0) ? 0.0 : statisticResultCummulative
        statisticResultCummulative := (1 + statisticResultCummulative) * (1 + statisticResult) - 1

        statisticResultColor = statisticResult > 0 ? statisticColorGreen : statisticColorRed
        table.cell(statisticTable, statisticColumn, statisticRow, str.tostring(math.round(statisticResult * 100, statisticPrecision)), bgcolor = statisticResultColor)

        // if it is the last item of the row or data array
        isStatisticLastOfTheRow = ((i + 1) % statisticGroupSize) == 0
        isStatisticLastOfTheData = i == (statisticLength - 1)
        if (isStatisticLastOfTheRow or isStatisticLastOfTheData)
            resultsTableCummulativeCellColor = statisticResultCummulative > 0 ? statisticColorGreen : statisticColorRed
            resultsTableCummulativeCellContent = str.tostring(math.round(statisticResultCummulative * 100, statisticPrecision))
            table.cell(statisticTable, 1 + statisticGroupSize, statisticRow, resultsTableCummulativeCellContent, bgcolor = resultsTableCummulativeCellColor)

مزید