بے ترتیب داخلے اور باہر نکلنے کی حکمت عملی

مصنف:چاؤ ژانگ، تاریخ: 2023-10-11 15:17:28
ٹیگز:

جائزہ

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

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

اس حکمت عملی کا بنیادی منطق یہ ہے:

  1. ہر شمعدان تصادفی طور پر 0 سے 100 کے درمیان ایک نمبر پیدا کرے گا.

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

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

  4. تین سمت کے انتخاب ہیں: صرف لمبی ، صرف مختصر ، یا بے ترتیب سمت۔ ڈیفالٹ صرف لمبی ہے۔

  5. شروع کا سال بھی مقرر کیا جا سکتا ہے تاکہ مارکیٹ میں بہت زیادہ اتار چڑھاؤ سے بچنے کے لئے.

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

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

  • حقیقی تاجر کی بے ترتیب فیصلہ سازی کا تقلید کرتا ہے، حقیقی مارکیٹ کے حالات کے قریب.

  • مختلف مارکیٹوں میں بے ترتیب تجارت کے کارکردگی کے اختلافات کی جانچ کر سکتے ہیں.

  • معلوم کر سکتے ہیں کہ کون سی مارکیٹیں بے ترتیب تجارت کے ساتھ بھی مثبت واپسی پیدا کرسکتی ہیں۔

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

خطرے کا تجزیہ

  • مارکیٹ کے رجحانات سے فائدہ اٹھانے کے قابل نہیں، بہترین داخلہ ٹائمنگ کا تعین کرنے کے قابل نہیں.

  • بے ترتیب باہر نکلنے سے نقصانات کو منفی سطحوں پر روک دیا جا سکتا ہے۔

  • واضح سمت کی تعصب کے ساتھ مارکیٹوں میں خراب کارکردگی کا مظاہرہ کرتا ہے.

  • زیادہ سے زیادہ تجارت یا ناکافی انعقاد کی مدت سے بچنے کے لئے اندراج / باہر نکلنے کے امکان کو بہتر بنانے کی ضرورت ہے.

  • بڑے نقصانات سے بچنے کے لئے اسٹاپ نقصان شامل کرنے پر غور کریں۔

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

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

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

  • ایک ہی تجارت کے خطرے کو کم کرنے کے لئے پوزیشن سائزنگ کو بہتر بنائیں.

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

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

خلاصہ

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


/*backtest
start: 2022-10-04 00:00:00
end: 2023-10-10 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
args: [["v_input_1",2]]
*/

//@version=4
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gregoirejohnb
//
// "tHe MaRkEtS aRe RaNdOm", say moron academics.
//
// The purpose of this study is to show that most markets are NOT random! Most markets show a clear bias where we can make such easy money, that a random number generator can do it.
// 
// === HOW THE INDICATOR WORKS ===
// 
// -The study will randomly enter the market
// -The study will randomly exit the market if in a trade
// -You can choose a Long Only, Short Only, or Bidirectional strategy
//
// === DEFAULT VALUES AND THEIR LOGIC ===
// 
// Percent Chance to Enter Per Bar: 10%
// Percent Chance to Exit Per Bar: 1%
// Direction: Long Only
// Commission: 0
//
// Each bar has a 10% chance to enter the market. Each bar has a 1% to exit the market [if in a trade]. It will only enter long.
//
// I included zero commission for simplication. It's a good exercise to include a commission/slippage to see just how much trading fees take from you.
// 
// === TIPS ===
//
// -Increasing "Percent Chance to Exit" will shorten the time in a trade. You can see the "Avg # Bars In Trade" go down as you increase. If "Percent Chance to Exit" is too high, the study won't be in the market long enough to catch any movement, possibly exiting on the same bar most of the time.
// -If you're getting the red screen, that means the strategy lost so much money it went broke. Try reducing the percent equity on the Properties tab.
// -Switch the start year to avoid black swan events like the covid drop in 2020.
// -
// === FINDINGS ===
//
// Most markets lose money with a "Random" direction strategy.
// Most markets lose ALL money with a "Short Only" strategy.
// Most markets make money with a "Long Only" strategy.
// 
// Try this strategy on: Bitcoin (BTCUSD) and the NASDAQ (QQQ).
//
// There are two popular memes right now: "Bitcoin to the moon" and "Stocks only go up". Both are seemingly true. Bitcoin was the best performing asset of the 2010's, gaining several billion percent in gains. The stock market is on a 100 year long uptrend. Why? BECAUSE FIAT CURRENCIES ALWAYS GO DOWN! This is inflation. If we measure the market in terms of others assets instead of fiat, the Long Only strategy doesn't work anymore.
// Try this strategy on: Bitcoin/GLD (BTCUSD/GLD), the Eurodollar (EURUSD), and the S&P 500 measured in gold (SPY/GLD).
// 
// Bitcoin measured in gold (BTCUSD/GLD) still works with a Long Only strategy because Bitcoin increased in value over both USD and gold.
// The Eurodollar (EURUSD) generally loses money no matter what, especially if you add any commission. This makes sense as they are both fiat currencies with similar inflation schedules.
// Gold and the S&P 500 have gained roughly the same amount since ~2000. Some years will show better results for a long strategy, while others will favor a short strategy. Now look at just SPY or GLD (which are both measured in USD by default!) and you'll see the same trend again: a Long Only strategy crushes even when entering and exiting randomly.
//
// === "JUST TELL ME WHAT TO DO, YOU NERD!" ===
//
// Bulls always win and Bears always lose because fiat currencies go to zero.
//
strategy(title="Random Entries Work", shorttitle="REW", overlay=true, pyramiding=0, default_qty_type=strategy.percent_of_equity, default_qty_value=100, currency=currency.USD,commission_type=strategy.commission.percent,commission_value=0)

// === GENERAL INPUTS ===
strategy = input(defval="Long Only",title="Direction",options=["Long Only", "Short Only", "Random"])
enter_frequency = input(defval=10,minval=1,maxval=100,title="Percent Chance to Enter")
exit_frequency = input(defval=3, minval=0,maxval=100,title="Percent Chance to Exit",tooltip="This should be much lower than Percent Chance to Enter. Higher values decrease time in market. Lower values increase time in market.")
start_year = input(defval=2020, title="Start Year")


// === LOGIC ===
r = random(0,100)
enter = enter_frequency > r[0]
exit = exit_frequency > r[0]
direction = random(0,100) >= 50

// === STRATEGY - LONG POSITION EXECUTION ===
enterLong() =>
    strategy.opentrades == 0 and enter and (strategy == "Long Only" or (strategy == "Random") and direction) and 
       time > timestamp(start_year, 01, 01, 01, 01)
exitLong() =>
    exit
strategy.entry(id="Long", long=strategy.long, when=enterLong())
strategy.close(id="Long", when=exitLong())
// === STRATEGY - SHORT POSITION EXECUTION ===
enterShort() =>
    strategy.opentrades == 0 and enter and (strategy == "Short Only" or (strategy == "Random" and not direction)) and 
       time > timestamp(start_year, 01, 01, 01, 01)
exitShort() =>
    exit
strategy.entry(id="Short", long=strategy.short, when=enterShort())
strategy.close(id="Short", when=exitShort())

مزید