ٹرینڈیلیوس

مصنف:چاؤ ژانگ، تاریخ: 2022-05-17 13:44:03
ٹیگز:بڑھتی ہوئی

اس اشارے کا استعمال ایک وقت کی مدت کے دوران سب سے زیادہ اور سب سے کم پوائنٹس کے رولنگ وسط کا استعمال کرتا ہے تاکہ یہ معلوم ہو سکے کہ آیا اثاثہ فی الحال ایک اپ ٹرینڈ یا ڈاؤن ٹرینڈ میں ہے.

اس سے موجودہ رجحان کو دیکھنے میں مدد ملتی ہے۔

پیرامیٹرز: 1/ لمبائی: اس مدت کی لمبائی جس کے دوران سب سے زیادہ اور سب سے کم سمجھا جائے گا 2/ قیمت کا ذریعہ: وہ ذریعہ جو حساب کتاب کے لئے استعمال کیا جائے گا 3/ جارحانہ موڈ: اگر یہ سچ ہے تو، رجحان کی سمت قیمت کی تبدیلی پر زیادہ ردعمل کرے گی اور تیزی سے اپ ٹرینڈ سے ڈاؤن ٹرینڈ اور دوسری طرف منتقل کرے گی.

شور سے بچنے کے لئے زیادہ وقت کے فریم پر استعمال کریں (4h، 12h، 1d وغیرہ)

ڈس کلیمر:

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

بیک ٹسٹ

img


/*backtest
start: 2022-05-09 00:00:00
end: 2022-05-15 23:59:00
period: 30m
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/
// © levieux

//@version=5
indicator("Trendelicious", overlay=true)

length=input(defval=30)
price=input(defval=hl2, title="Price Source")
aggressiveMode=input(defval=false,title="Aggressive Mode")

isUptrend(price,length,aggressiveMode) =>
    uptrend= false
    PP= (ta.highest(price,length)+ta.lowest(price,length))/2
    ppChange= ta.change(PP,1)
    ppFlat= ppChange==0
    priceOverPP=ta.crossover(price,PP)
    priceUnderPP=ta.crossunder(price,PP)
    risingPrice= ta.rising(price,5)
    risingPP= ta.rising(PP,5)
    fallingPrice= ta.falling(price,5)
    fallingPP= ta.falling(PP,5)

    uptrendCondition1= price>PP and (ppChange>0 or (ppChange==0 and aggressiveMode)) and (ppChange[1]>0 or (ppChange[1]==0 and aggressiveMode)) and ppChange[2]>=0 and ppChange[3]>=0
    uptrendCondition2= (priceOverPP or risingPrice) and ppFlat and aggressiveMode
    uptrendCondition3= risingPrice and fallingPP and aggressiveMode
    downtrendCondition1= price < PP and (ppChange<0 or (ppChange==0 and aggressiveMode)) and (ppChange[1]<0 or (ppChange[1]==0 and aggressiveMode)) and ppChange[2]<=0 and ppChange[3]<=0
    downtrendCondition2= (priceUnderPP or fallingPrice) and ppFlat and aggressiveMode
    downtrendCondition3= fallingPrice and risingPP and aggressiveMode

    if uptrendCondition1 or uptrendCondition2 or uptrendCondition3
        uptrend:= true
    else if downtrendCondition1 or downtrendCondition2 or downtrendCondition3
        uptrend:= false
    else
        uptrend:= uptrend[1]
    [PP,uptrend]

[trendline,uptrend]= isUptrend(price,length,aggressiveMode)

baseLinePlot = plot((open + close) / 2, display=display.none)
upTrendPlot = plot(uptrend ? trendline : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrendPlot = plot(not uptrend ? trendline : na, "Down Trend", color = color.red, style=plot.style_linebr)
fill(baseLinePlot, upTrendPlot, color.new(color.green, 90), fillgaps=false)
fill(baseLinePlot, downTrendPlot, color.new(color.red, 90), fillgaps=false)

if uptrend
    strategy.entry("Enter Long", strategy.long)
else if not uptrend
    strategy.entry("Enter Short", strategy.short)

متعلقہ

مزید