اورین ٹریڈنگ کی حکمت عملی


تخلیق کی تاریخ: 2023-09-25 18:32:52 آخر میں ترمیم کریں: 2023-09-25 18:32:52
کاپی: 0 کلکس کی تعداد: 819
1
پر توجہ دیں
1617
پیروکار

جائزہ

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

حکمت عملی کا اصول

اس حکمت عملی کا مرکز ایک منفرد اوریگون سگنل منحنی خطوط ہے۔ اس منحنی خطوط کو متعدد تکنیکی اشارے ، بشمول MACD ، WPR ، Stoch ، RSI ، وغیرہ کو مربوط کرکے ایک جامع سگنل کا حساب لگایا جاتا ہے۔ اس کے بعد حتمی منحنی خطوط کو انتہائی ہموار عمل کے ذریعہ تیار کیا جاتا ہے۔

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

اس کے علاوہ ، حکمت عملی بڑے پیمانے پر رجحان کی سمت کا اندازہ لگانے کے لئے حرکیاتی لہر کے اشارے کا استعمال کرتی ہے۔ جب حرکیاتی لہر کی سمت تبدیل ہوتی ہے تو ، اشارے بڑے پیمانے پر الٹ ہونے کا امکان ہوتا ہے۔

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

طاقت کا تجزیہ

  • ملٹی انڈیکیٹر انٹیگریٹڈ ججنگ ، بہتر درستگی

ایک سے زیادہ اشارے کو یکجا کرنے سے رجحانات کی تصدیق اور ٹرن آؤٹ پوائنٹس کی نشاندہی کرنے میں مدد ملتی ہے ، جس سے کسی ایک اشارے کے غلط فہمی کا خطرہ ہوتا ہے۔

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

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

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

اعلی ٹائم فریم کے ساتھ مل کر متحرک لہر کے اشارے ، ریورس آپریشن سے گریز کریں۔

  • اپنی مرضی کے مطابق پیرامیٹرز، مختلف اقسام کے مطابق

صارفین کو مختلف اقسام کی خصوصیات کو ایڈجسٹ کرنے کے لئے اشارے پیرامیٹرز کو ایڈجسٹ کر سکتے ہیں.

خطرے کا تجزیہ

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

پیشن گوئی کرنے والے ماڈل غلط سگنل دینے کے لئے آسان ہیں ، اور اگر اندھے طور پر پیروی کی جائے تو ، یہ زیادہ تجارت کا سبب بن سکتا ہے۔

  • کثیر پیرامیٹرز کے مجموعے کو بہتر بنانے میں دشواری

پیرامیٹرز کی ایک بڑی تعداد کے ساتھ ، زیادہ سے زیادہ مجموعہ تلاش کرنے کے لئے بڑے پیمانے پر ڈیٹا سیٹ اور طویل وقت کی جانچ کی ضرورت ہوتی ہے۔

  • انڈیکیٹرز کی کارکردگی کا محتاط اندازہ لگانا

سگنل میں اضافے کے لئے ہر اشارے کے عملی اثر کا محتاط اندازہ لگانا ضروری ہے ، اور ضرورت سے زیادہ اشارے استعمال کرنے سے گریز کرنا چاہئے۔

  • فکسڈ ٹرانزیکشن لاگت کے عوامل پر غور کریں

زیادہ بار بار تجارت کرنے سے زیادہ لاگت آتی ہے ، جس کی وجہ سے ریئل اسٹیٹ کے حالات میں معائنہ کرنے پر غور کرنا چاہئے۔

اصلاح کی سمت

  • پیشن گوئی کے ماڈل کے اثرات کا جائزہ لیں اور پیرامیٹرز کو ایڈجسٹ کریں

پیشن گوئی کے ماڈل کی درستگی کا اندازہ لگانا ، اور پیشن گوئی کے پیرامیٹرز کو بہتر بنانے کے ل.

  • ماڈل کو آسان بنانے اور اشارے کو کم کرنے کے لئے

غیر ضروری پیچیدگیوں کو کم کرنے کے لئے ، کارکردگی کی پیمائش اور ماڈل کو آسان بنانے کے طریقوں کا استعمال کریں۔

  • ملٹی مارکیٹ ریٹرننگ نے استحکام کی تصدیق کی

مزید مارکیٹوں میں جانچ پڑتال، پیرامیٹرز کی اصلاح کے نتائج اور استحکام کی توثیق.

  • فکسڈ لاگت پر غور کرنے کے لئے حکمت عملی میں تبدیلی

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

خلاصہ کریں۔

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

حکمت عملی کا ماخذ کوڈ
/*backtest
start: 2023-09-17 00:00:00
end: 2023-09-21 22:00:00
period: 3m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// © OrionAlgo
//          () /? | () |\|   /\ |_ (_, ()          //
//@version=4

version = '2.0'

strategy("Orion Algo Strategy v"+version, shorttitle="Orion Algo Strategy v"+version, overlay=false, pyramiding=100)


// Getting inputs --------------------------------------------------------------
userAgreement = input(true, title='I understand that Orion Algo cannot be 100% accurate and overall performance will shift with market conditions. While Orion Algo increases my chances of entering better positions, I must use smart trade management. ', type=input.bool,group='User Agreement ─────────────',
  tooltip='In order to use Orion Algo, you must click the checkbox to acknowledge the user agreement')

src = close
//smoothing inputs -------------------------------------------------------------

//superSmooth = input(true, title='Super Smooth', inline='Super Smooth', group='Smoothing ─────────────────')
superSmooth = true
smoothType = 1
superSmoothStrength = input(10, title='Super Smooth',minval = 3, inline='Super Smooth', group='Signal ────────────────────',
  tooltip='Smooths the signal. Lower values move pivots to the left while increasing noise, higher values move pivots to the right and reduce noise. 8 is a good mix of both') // set to timeframe for decent results?
//trendSmoothing = input(30, title='Trend Smooth',minval = 3, group='Smoothing ─────────────────') // set to timeframe for decent results?
trendSmoothing = 30 // set to timeframe for decent results?

showPrediction = input(false, title='Prediction', group='Signal ────────────────────',inline='prediction')
predictionBias = input(0.45, minval = 0.,maxval=1., step=0.05, title='Bias', group='Signal ────────────────────',inline='prediction')
showPredictionCurve = input(true, title='Curve', group='Signal ────────────────────',inline='prediction', tooltip='Prediction model that attempts to predict short range reversals (0-2 bars). Adjust Bias to change the prediction curve.')

//momentum wave inputs ---------------------------------------------------------
showMomentumWave = input(true, 'Momentum Wave', group='Momentum Wave ─────────────', inline='mom')
momentumWaveLength = input(3, '', group='Momentum Wave ─────────────', inline='mom', tooltip='Secondary signal that shows medium to large movements based on the input variable. The wave will change depending on the current timeframe.')
momentumOutside = input(true, 'Position Outside', group='Momentum Wave ─────────────', inline='mom2', tooltip='Positions the wave outside of the main signal area.')

//visuals input-----------------------------------------------------------------

useDarkMode = input(true, 'Dark Mode', group='Visuals ───────────────────',inline='Colors')

// 0:backgroundlines, 1:signal, 2:bullish, 3:bearish, 4:hiddenbull, 5:hiddenbear, 6:deltav, 7:prediction, 8:predictionbull, 9:predictionbear, 10:dash, 11:mom2

visualMode = input('Pro', 'Mode',options=['Beginner', 'Pro'] ,group='Visuals ───────────────────')

dashOn = input(true, "Dashboard", group='Dashboard ─────────────────', inline='dash', tooltip='A dashboard with some usefual stats')
  
dashColor = color.new(#171a27, 100)

showPivots = input(true, title='Signal Pivots', group='Pivots ────────────────────',inline='pivots')
showPredictionPivots = input(false, title='Prediction Pivots', group='Pivots ────────────────────',inline='pivots')


// Functions -------------------------------------------------------------------

f_secureSecurity(_symbol, _res, _src) => security(_symbol, _res, _src,barmerge.gaps_on, lookahead = barmerge.lookahead_on) 

f_slope(x) =>
    slopePeriod = 1
    (x - x[slopePeriod]) / slopePeriod

f_superSmooth(inputVal,smoothType) =>
    smoothType==1? (hma(inputVal,superSmoothStrength)) :
      smoothType==2? (ema((ema((ema(inputVal,3)),3)),superSmoothStrength)):
      smoothType==3? linreg(inputVal,superSmoothStrength,0) : 
      smoothType==4? (hma(inputVal,superSmoothStrength * momentumWaveLength)) : na

f_bias(bias, min, max) =>
    (bias * (max - min) ) + min

f_resInMinutes() =>
    _resInMinutes = timeframe.multiplier * (
      timeframe.isseconds ? 1. / 60. :
      timeframe.isminutes ? 1.       :
      timeframe.isdaily   ? 1440.    :
      timeframe.isweekly  ? 10080.   :
      timeframe.ismonthly ? 43800.   : na)

f_resFromMinutes(_minutes) =>
    _minutes     <= 0.0167       ? "1S"  :
      _minutes   <= 0.0834       ? "5S"  :
      _minutes   <= 0.2500       ? "15S" :
      _minutes   <= 0.5000       ? "30S" :
      _minutes   <= 1            ? "1":
      _minutes   <= 1440         ? tostring(round(_minutes)) :
      _minutes   <= 43800        ? tostring(round(min(_minutes / 1440, 365))) + "D" :
      tostring(round(min(_minutes / 43800, 12))) + "M"
      
f_output_signal()=>    
    a = ((ema(close, 12) - ema(close, 26)) - ema((ema(close, 12) - ema(close, 26)), 8))/10
    b = wpr(8)
    c = (100 * ( close + 2*stdev( close, 21) - sma( close, 21 ) ) / ( 4 * stdev( close, 21 ) ))
    d = (rsi(close - sma(close, 21)[11],8)*2)-100
    e = (rsi(fixnan(100 * rma(change(high) > change(low) and change(high) > 0 ? change(high) : 0, 1) / rma(tr, 1)) - fixnan(100 * rma(change(low) > change(high) and change(low) > 0 ? change(low) : 0, 1) / rma(tr, 1)),8)*2)-100 //causes slow down
    f = rsi((((close-( (sum(volume, 20) - volume)/sum(volume, 20)) + (volume*close/sum(volume, 20)))/((close+( (sum(volume, 20) - volume)/sum(volume, 20)) + (volume*close/sum(volume, 20)))/2)) * 100),8)-100
    g = (rsi(sma(highest(high,14)-lowest(low,14)==0.0?0.0:(close-lowest(low,14))/highest(high,14)-lowest(low,14)-0.5,max(1,int(2))),8)*2)-100 //causes slow down
    avg(a,b,c,d,e,f,g)*2
 
output_signal = f_output_signal()
output_signal := f_superSmooth(output_signal,1)

// output_signal2 = plot(f_superSmoothSlow(f_output_signal()), color=color.blue, linewidth=2)

//Orion Signal Higher Timeframe / Momentum Wave --------------------------------
f_momentumWave(wavelength,smooth) =>
    currentMinutes = f_resInMinutes()
    m = currentMinutes * wavelength //multiply current resolution by momentumWaveLength to get higher resolution
    momentumWaveRes = f_resFromMinutes(m)
    f_secureSecurity(syminfo.tickerid, momentumWaveRes,f_superSmooth(f_output_signal(),1))



// Plot ------------------------------------------------------------------------
f_color(x) =>
    if userAgreement
        white      = useDarkMode ? #e5e4f4 : #505050ff
        lightgray  = useDarkMode ? #808080 : #909090ff
        gray       = useDarkMode ? #808080 : #505050ff
        //blue       = useDarkMode ? #007EA7 : #007EA7ff
        blue       = useDarkMode ? #2862FFFF : #2862FFFF
        
        // 0:backgroundlines, 1:signal, 2:bullish, 3:bearish, 4:hiddenbull, 5:hiddenbear, 6:deltav, 7:prediction, 8:predictionbull, 9:predictionbear, 10:trendbull, 11:trendbear, 12:dash, 13:mom1, 14:mom2
        x==0? lightgray : x==1? gray : x==2? white : x==3? blue : x==4? white : x==5? blue : x==6? blue : x==7? blue : x==8? white : x==9? blue : x==10? blue : x==11? blue : na

// Lines -----------------------------------------------------------------------

h1 = plot(0, "Mid Band", color=f_color(0),editable=0, transp=80)

// Signal ----------------------------------------------------------------------

orionSignal = plot(output_signal, title="Orion Signal Curve", style=plot.style_line,linewidth=1, transp=0, color= f_color(1), offset=0,editable=0)


// Momentum Wave ---------------------------------------------------------------
momWave = f_momentumWave(momentumWaveLength,1)


p_momWave = plot(showMomentumWave? momentumOutside? (momWave/2) -150 : momWave : na, color=f_color(11), linewidth=showMomentumWave and momentumOutside ? 1 : 2, editable =0, transp=50, style=momentumOutside? plot.style_area : plot.style_line, histbase=-200) //two tone color doesnt want to work with this for some reason.

// Divergence ------------------------------------------------------------------

osc = output_signal

plFound = osc > osc [1] and osc[1] < osc[2]
phFound = osc < osc [1] and osc[1] > osc[2]

// bullish

plot(
     plFound and visualMode=='Pro'?  osc[1] - 10 : na,
     offset=0,
     title="Regular Bullish",
     linewidth=3,
     color=showPivots ? f_color(2) :na,
     transp=0,
     style=plot.style_circles,
     editable=0
     )
plotshape(
     plFound and visualMode=='Beginner'?  osc[1] - 10 : na,
     offset=0,
     title="Regular Bullish",
     size=size.tiny,
     color=showPivots ? f_color(2) :na,
     transp=0,
     style=shape.labelup,
     text = 'Buy',
     textcolor= color.black,
     location=location.absolute,
     editable=0
     )


// bearish
plot(
     phFound and visualMode=='Pro'? osc[1] + 10: na,
     offset=0,
     title="Regular Bearish",
     linewidth=3,
     color=showPivots ? f_color(3):na,
     transp=0,
     style=plot.style_circles,
     editable=0
     )
plotshape(
     phFound and visualMode=='Beginner'? osc[1] + 10: na,
     offset=0,
     title="Regular Bearish",
     size=size.tiny,
     color=showPivots ? f_color(3):na,
     transp=0,
     style=shape.labeldown,
     text = 'Sell',
     textcolor= color.white,
     location=location.absolute,
     editable=0
     )



// Delta v ---------------------------------------------------------------------

slope    = f_slope(output_signal)*1.5

// Prediction from Delta v -----------------------------------------------------
output_prediction = f_bias(predictionBias, slope, output_signal)

prediction_bullish = output_prediction>output_prediction[1] and output_prediction[1]<output_prediction[2] ?true:false
prediction_bearish = output_prediction<output_prediction[1] and output_prediction[1]>output_prediction[2] ?true:false

plot(showPrediction and showPredictionCurve?output_prediction:na,title='Prediction Curve', color=f_color(7), editable=0)
//prediction bull
plot(showPrediction?showPredictionPivots?output_prediction>output_prediction[1] and output_prediction[1]<output_prediction[2]?showPredictionCurve?output_prediction:output_signal:na:na:na,
  title='Prediction Bullish',color=f_color(8), style=plot.style_circles, linewidth=2, editable=0)
//prediction bear
plot(showPrediction?showPredictionPivots?output_prediction<output_prediction[1] and output_prediction[1]>output_prediction[2]?showPredictionCurve?output_prediction:output_signal:na:na:na,
  title='Prediction Bearish', color=f_color(9), style=plot.style_circles, linewidth=2, editable=0)

// User Aggreement -------------------------------------------------------------

plotshape(userAgreement==false?0:na,title='Welcome', text='Welcome to Orion Algo! Please double click me to enable signals',textcolor=color.black,color=color.white,offset=0,size=size.huge,style=shape.labeldown,location=location.absolute, transp=0, show_last=1, editable=0)
plotshape(userAgreement==false?0:na,title='Welcome', text='Welcome to Orion Algo! Please double click me to enable signals',textcolor=color.black,color=color.white,offset=-100,size=size.huge,style=shape.labeldown,location=location.absolute, transp=0, show_last=1, editable=0)

// Alerts ----------------------------------------------------------------------

alertcondition(plFound,title='1. Bullish (Big Dot)', message='Bullish Signal (Big Dot)')
alertcondition(phFound,title='2. Bearish (Big Dot)', message='Bearish Signal (Big Dot)')
alertcondition(prediction_bullish,title='3. Prediction Bullish (Small Dot)', message='Prediction Bullish Signal (Small Dot)')
alertcondition(prediction_bearish,title='4. Prediction Bearish (Small Dot)', message='Prediction Bearish Signal (Small Dot)')





// Strategy --------------------------------------------------------------------
i_strategy = input(defval='dca long', title='strategy', options=['simple','dca long'])
i_pyramid = input(10, 'pyramid orders')

// Simple Strat
if (i_strategy == 'simple')
    longCondition = crossover(output_signal, output_signal[1])
    if (longCondition)
        strategy.entry("My Long Entry Id", strategy.long)
    
    shortCondition = crossunder(output_signal, output_signal[1])
    if (shortCondition)
        strategy.entry("My Short Entry Id", strategy.short)

// DCA Strat
i_percent_exit = input(2.0,'percent exit in profit')/100
i_percent_drop = input(2.0,'percent drop before each entry')/100

var entryPrice = 0.0
var exitPrice = 0.0


var inTrade = false
var tradeCount = 0
var moneyInTrade = 0.0

if(output_signal > output_signal[1] and output_signal[1]<=output_signal[2] and i_strategy=='dca long')
//if (true)    
    if (inTrade==false)
        strategy.entry('Long',long=true)
        entryPrice:=close
        moneyInTrade:=close
        exitPrice:=entryPrice + (entryPrice*(i_percent_exit))
        inTrade:=true
        tradeCount := 1
        
    if (inTrade==true and close <= (entryPrice-(entryPrice*(i_percent_drop) )))
        //calculate DCA //math is incorrect!!!
        if (tradeCount <= i_pyramid)
            tradeCount := tradeCount+1
            entryPrice:=close
            moneyInTrade := moneyInTrade+close
            exitPrice2 = moneyInTrade / tradeCount
            exitPrice := exitPrice2 + (exitPrice2 *(i_percent_exit)) 
           
            strategy.entry('Long',long=true)
            

if(close >= exitPrice and inTrade==true and output_signal <= output_signal[1] and output_signal[1]>=output_signal[2] and i_strategy=='dca long')
    inTrade:=false
   
    strategy.close('Long')
    
    


// Dashboard -------------------------------------------------------------------


//deltav
deltav = slope