
اس حکمت عملی کا مقصد اسٹاک کی قیمتوں کے رجحان کی سمت کو پکڑنے کے لئے یہ فیصلہ کرنا ہے کہ آیا اسٹاک کی قیمتیں 200 دن کی اوسط اوسط سے تجاوز کرتی ہیں یا نہیں۔ جب قیمتیں 200 دن کی اوسط سے تجاوز کرتی ہیں تو ایک سے زیادہ پوزیشن قائم کریں ، ورنہ اسٹاک کو صاف کریں۔
یہ حکمت عملی مجموعی طور پر آسان اور عملی ہے ، اور اسٹاک کی درمیانی اور طویل مدتی قیمتوں کے رجحانات کو مؤثر طریقے سے پکڑنے کے لئے اختتام کے آخر میں 200 دن کی اوسط لائن کو توڑنے کے ذریعہ ، پیچھے ہٹنا اور کم خطرہ ہے۔ مزید اشارے کے فیصلے اور متحرک اصلاح کے ساتھ مل کر ، حکمت عملی کی استحکام اور منافع کی شرح کو مزید بڑھاوا دیا جاسکتا ہے۔
/*backtest
start: 2022-12-01 00:00:00
end: 2023-12-07 00:00:00
period: 1d
basePeriod: 1h
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/
// © muscleriot
//200 dma
//2000-2016 backtested
//1 signal per month only at end of month
//If > 200DMA enter long
//If < 200DMA goto cash
//results: 318% drawdown 17% vs 125% with 55% drawdown for buy and hold
//@version=5
strategy("200DMA last DOM - ajh", overlay =true,default_qty_type=strategy.percent_of_equity, default_qty_value=100)
// Use 100% of equity always
dma200 = ta.sma(close, 200)
plot(dma200, color=color.red, linewidth = 2)
//e =dayofmonth(time)
// backtesting date range
from_day = input.int(defval=1, title="From Day", minval=1, maxval=31)
from_month = input.int(defval=1, title="From Month", minval=1, maxval=12)
from_year = input.int(defval=2018, title="From Year", minval=1900)
to_day = input.int(defval=1, title="To Day", minval=1, maxval=31)
to_month = input.int(defval=1, title="To Month", minval=1, maxval=12)
to_year = input.int(defval=9999, title="To Year", minval=1900)
time_cond = time > timestamp(from_year, from_month, from_day, 00, 00) and
time < timestamp(to_year, to_month, to_day, 23, 59)
xLong = dayofmonth(time) == 30 and (close > dma200) ? true : na
xSell = dayofmonth(time) == 30 and (close < dma200) ? true : na
plotchar(xLong, "long","L", color=color.green)
plotchar(xSell, "Sell","S", color=color.red)
if (xLong == true) and time_cond
strategy.entry("long", strategy.long)
if (xSell == true) and time_cond
strategy.close("long")