ইএমএ/এডিএক্স/ভোল-ক্রিপ্টো কিলার

লেখক:চাওঝাং, তারিখ: ২০২৩-১২-০৫ ১১ঃ৩৩ঃ৩৭
ট্যাগঃ

img

একটি পরিমাণগত ট্রেডিং কৌশল যা প্রবণতা দিক নির্ধারণের জন্য একটি EMA সিস্টেম ব্যবহার করে, প্রবণতা শক্তি নির্ধারণের জন্য ADX সূচক এবং প্রবেশের জন্য ট্রেডিং ভলিউম ফিল্টারিং অন্তর্ভুক্ত করে

নীতি

এই কৌশলটি প্রথমে মূল্য প্রবণতা দিক বিচার করতে বিভিন্ন সময়ের 5 টি ইএমএ ব্যবহার করে। যখন সমস্ত 5 টি ইএমএ বৃদ্ধি পায়, এটি একটি উত্থান প্রবণতা গঠন হিসাবে বিচার করা হয়। যখন সমস্ত 5 টি ইএমএ হ্রাস পায়, এটি একটি হ্রাস প্রবণতা গঠন হিসাবে বিচার করা হয়।

এটি তারপর প্রবণতার শক্তি বিচার করতে ADX সূচক ব্যবহার করে। যখন DI + লাইনটি DI- লাইনের চেয়ে বেশি এবং ADX মানটি সেট থ্রেশহোল্ড অতিক্রম করে, এটি একটি শক্তিশালী বুলিশ প্রবণতা হিসাবে বিচার করা হয়। যখন DI + লাইনটি DI + লাইনের চেয়ে বেশি এবং ADX মানটি সেট থ্রেশহোল্ড অতিক্রম করে, এটি একটি হ্রাস প্রবণতা হিসাবে বিচার করা হয়।

একই সময়ে, ট্রেডিং ভলিউমের অগ্রগতিগুলি অতিরিক্ত নিশ্চিতকরণের জন্য ব্যবহৃত হয়, যা বর্তমান K-লাইনটির ট্রেডিং ভলিউমকে একটি সময়ের মধ্যে গড় ভলিউমের একটি নির্দিষ্ট গুণের চেয়ে বেশি হতে বাধ্য করে, যার ফলে কম ভলিউম পজিশনে ভুল এন্ট্রিগুলি এড়ানো যায়।

প্রবণতা দিক, প্রবণতা শক্তি এবং ট্রেডিং ভলিউমের ব্যাপক বিচারের সাথে মিলিয়ে এই কৌশলটির দীর্ঘ এবং সংক্ষিপ্ত উদ্বোধনী যুক্তি গঠিত হয়।

সুবিধা

  1. প্রবণতার দিকনির্দেশনা নির্ধারণের জন্য একটি EMA সিস্টেম ব্যবহার করা একক EMA এর চেয়ে বেশি নির্ভরযোগ্য।

  2. প্রবণতার তীব্রতা নির্ধারণের জন্য ADX সূচক ব্যবহার করা স্পষ্ট প্রবণতা না থাকলে ভুল এন্ট্রি এড়ানো যায়।

  3. ট্রেডিং ভলিউম ফিল্টার প্রক্রিয়াটি পর্যাপ্ত ট্রেডিং ভলিউম সমর্থন নিশ্চিত করে এবং কৌশলটির নির্ভরযোগ্যতা বাড়ায়।

  4. মাল্টিপল কন্ডিশন কম্প্রিহেনসিভ ডিসচার্জিং ওপেনিং সিগন্যালকে আরো সুনির্দিষ্ট এবং নির্ভরযোগ্য করে তোলে।

  5. কৌশলগত পরামিতিগুলির তুলনামূলকভাবে বড় সংখ্যা চলমান পরামিতি অপ্টিমাইজেশনের মাধ্যমে পারফরম্যান্সের উন্নতি করতে দেয়।

ঝুঁকি এবং সমাধান

  1. পরিসীমা-বান্ধব বাজারে, EMA, ADX এবং অন্যান্য রায়গুলি ভুল সংকেত দিতে পারে, যার ফলে অপ্রয়োজনীয় ক্ষতি হতে পারে। পরামিতিগুলি যথাযথভাবে সামঞ্জস্য করা যেতে পারে বা সহায়ক রায়ের জন্য অন্যান্য সূচক যুক্ত করা যেতে পারে।

  2. ট্রেডিং ভলিউম ফিল্টার শর্তগুলি খুব কঠোর হতে পারে, বাজারের সুযোগগুলি মিস করতে পারে। পরামিতিগুলি যথাযথভাবে হ্রাস করা যেতে পারে।

  3. কৌশল দ্বারা উত্পন্ন ট্রেডিং ফ্রিকোয়েন্সি তুলনামূলকভাবে উচ্চ হতে পারে। অর্থ পরিচালনার প্রতি মনোযোগ দেওয়া উচিত এবং একক অবস্থানের আকার যথাযথভাবে নিয়ন্ত্রণ করা উচিত।

অপ্টিমাইজেশান নির্দেশাবলী

  1. কৌশল কর্মক্ষমতা উন্নত করার জন্য সর্বোত্তম পরামিতি খুঁজে পেতে বিভিন্ন পরামিতি সমন্বয় পরীক্ষা করুন।

  2. আরও শক্তিশালী ও ব্যাপক ওপেন পজিশন রায় গঠনের জন্য EMA এবং ADX এর সাথে সংযুক্ত করার জন্য MACD, KDJ এর মতো অন্যান্য সূচক যুক্ত করুন।

  3. ঝুঁকি নিয়ন্ত্রণের জন্য স্টপ লস কৌশল যুক্ত করুন।

  4. আরও বিজ্ঞানসম্মত মূলধন পরিচালনার লক্ষ্যে পজিশন ম্যানেজমেন্টের কৌশলগুলি অপ্টিমাইজ করা।

সংক্ষিপ্তসার

দামের প্রবণতা দিক, প্রবণতা শক্তি এবং ট্রেডিং ভলিউম সম্পর্কিত তথ্যকে ব্যাপকভাবে বিবেচনা করে, এই কৌশলটি কিছু সাধারণ ফাঁদ এড়ানোর জন্য খোলার নিয়ম গঠন করে এবং তুলনামূলকভাবে শক্তিশালী নির্ভরযোগ্যতা রয়েছে। তবে পারফরম্যান্সকে আরও উন্নত করতে প্যারামিটার অপ্টিমাইজেশন, সূচক নির্বাচন এবং ঝুঁকি নিয়ন্ত্রণের মাধ্যমে কৌশল ব্যবস্থার আরও উন্নতি প্রয়োজন। সাধারণভাবে, এই কৌশল কাঠামোর সম্প্রসারণ এবং অপ্টিমাইজেশনের জায়গার জন্য দুর্দান্ত সম্ভাবনা রয়েছে।


/*backtest
start: 2022-11-28 00:00:00
end: 2023-12-04 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/
// © BabehDyo


//@version=4


strategy("EMA/ADX/VOL-CRYPTO KILLER [15M]", overlay = true, pyramiding=1,initial_capital = 10000, default_qty_type= strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills=false, slippage=0,commission_type=strategy.commission.percent,commission_value=0.03)

//SOURCE =============================================================================================================================================================================================================================================================================================================

src                 =                   input(open,                             title="  Source")

// Inputs ========================================================================================================================================================================================================================================================================================================

//ADX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

ADX_options         =                   input("MASANAKAMURA",                   title="  Adx Type",                                       options = ["CLASSIC", "MASANAKAMURA"],                                            group="ADX")
ADX_len             =                   input(21,                               title="  Adx Length",                                     type=input.integer, minval = 1,                                                   group="ADX")
th                  =                   input(20,                               title="  Adx Treshold",                                   type=input.float, minval = 0, step = 0.5,                                         group="ADX")

//EMA--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Length_ema1 = input(8,  title="  1-EMA Length", minval=1)
Length_ema2 = input(13, title="  2-EMA Length", minval=1)
Length_ema3 = input(21, title="  3-EMA Length", minval=1)
Length_ema4 = input(34, title="  4-EMA Length", minval=1)
Length_ema5 = input(55, title="  5-EMA Length", minval=1)


// Range Filter ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

per_                =                   input(15,                               title="  Period",                                             minval=1,                                                                       group = "Range Filter")
mult                =                   input(2.6,                              title="  mult.",                                              minval=0.1, step = 0.1,                                                         group = "Range Filter")


// Volume ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

volume_f            =                   input(3.2,                              title="  Volume mult.",                                       minval = 0, step = 0.1,                                                         group="Volume")
sma_length          =                   input(20,                               title="  Volume lenght",                                      minval = 1,                                                                     group="Volume")

volume_f1            =                   input(1.9,                              title="  Volume mult. 1",                                       minval = 0, step = 0.1,                                                         group="Volume")
sma_length1          =                   input(22,                               title="  Volume lenght 1",                                      minval = 1,                                                                     group="Volume")


//TP PLOTSHAPE -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

tp_long0            =                   input(0.9,                              title="  % TP Long",                                        type = input.float,     minval = 0,     step = 0.1,                           group="Target Point") 
tp_short0           =                   input(0.9,                              title="  % TP Short",                                       type = input.float,     minval = 0,     step = 0.1,                           group="Target Point") 

// SL PLOTSHAPE ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

sl0                 =                   input(4.2,                              title="  % Stop loss",                                        type = input.float,     minval = 0,     step = 0.1,                             group="Stop Loss")

//INDICATORS =======================================================================================================================================================================================================================================================================================================

//ADX-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

calcADX(_len) =>
    up              =                                                                                                                       change(high)
	down            =                                                                                                                      -change(low)
	plusDM          =                                                                                                                       na(up)   ? na : (up > down and up > 0   ? up   : 0)
    minusDM         =                                                                                                                       na(down) ? na : (down > up and down > 0 ? down : 0)
	truerange       =                                                                                                                       rma(tr, _len)
	_plus           =                                                                                                                       fixnan(100 * rma(plusDM, _len)  / truerange)
	_minus          =                                                                                                                       fixnan(100 * rma(minusDM, _len) / truerange)
	sum             =                                                                                                                       _plus + _minus
	_adx            =                                                                                                                       100 * rma(abs(_plus - _minus) / (sum == 0 ? 1 : sum), _len)
    [_plus,_minus,_adx]
calcADX_Masanakamura(_len) =>
    SmoothedTrueRange                   =                                                                                                   0.0
    SmoothedDirectionalMovementPlus     =                                                                                                   0.0
    SmoothedDirectionalMovementMinus    =                                                                                                   0.0
    TrueRange                           =                                                                                                   max(max(high - low, abs(high - nz(close[1]))), abs(low - nz(close[1])))
    DirectionalMovementPlus             =                                                                                                   high - nz(high[1]) > nz(low[1]) - low ? max(high - nz(high[1]), 0) : 0
    DirectionalMovementMinus            =                                                                                                   nz(low[1]) - low > high - nz(high[1]) ? max(nz(low[1]) - low, 0)   : 0
    SmoothedTrueRange                   :=                                                                                                  nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1]) /_len) + TrueRange
    SmoothedDirectionalMovementPlus     :=                                                                                                  nz(SmoothedDirectionalMovementPlus[1])  - (nz(SmoothedDirectionalMovementPlus[1])  / _len) + DirectionalMovementPlus
    SmoothedDirectionalMovementMinus    :=                                                                                                  nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1]) / _len) + DirectionalMovementMinus
    DIP                                 =                                                                                                   SmoothedDirectionalMovementPlus  / SmoothedTrueRange * 100
    DIM                                 =                                                                                                   SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
    DX                                  =                                                                                                   abs(DIP-DIM) / (DIP+DIM)*100
    adx                                 =                                                                                                   sma(DX, _len)
    [DIP,DIM,adx]
[DIPlusC,DIMinusC,ADXC] =                                                                                                                   calcADX(ADX_len) 
[DIPlusM,DIMinusM,ADXM] =                                                                                                                   calcADX_Masanakamura(ADX_len)

DIPlus                  =                                                                                                                   ADX_options == "CLASSIC" ? DIPlusC    : DIPlusM
DIMinus                 =                                                                                                                   ADX_options == "CLASSIC" ? DIMinusC   : DIMinusM
ADX                     =                                                                                                                   ADX_options == "CLASSIC" ? ADXC       : ADXM
L_adx                   =                                                       DIPlus > DIMinus and ADX > th
S_adx                   =                                                       DIPlus < DIMinus and ADX > th

//EMA-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

xPrice = close
EMA1 = ema(xPrice, Length_ema1)
EMA2 = ema(xPrice, Length_ema2)
EMA3 = ema(xPrice, Length_ema3)
EMA4 = ema(xPrice, Length_ema4)
EMA5 = ema(xPrice, Length_ema5)
L_ema			=							EMA1 < close and  EMA2 < close and  EMA3  < close and  EMA4  < close and  EMA5  < close
S_ema			=							EMA1 > close and  EMA2 > close and  EMA3  > close and  EMA4  > close and  EMA5  > close


// Range Filter ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var bool L_RF = na,  var bool S_RF = na

Range_filter(_src, _per_, _mult)=>
    var float _upward   =                                                                                                                   0.0
    var float _downward =                                                                                                                   0.0
    wper                =                                                                                                                   (_per_*2) - 1
    avrng               =                                                                                                                   ema(abs(_src - _src[1]), _per_)
    _smoothrng          =                                                                                                                   ema(avrng, wper)*_mult
    _filt               =                                                                                                                   _src
    _filt               :=                                                                                                                  _src > nz(_filt[1]) ? ((_src-_smoothrng) < nz(_filt[1]) ? nz(_filt[1]) : (_src-_smoothrng)) : ((_src+_smoothrng) > nz(_filt[1]) ? nz(_filt[1]) : (_src+_smoothrng))
    _upward             :=                                                                                                                  _filt > _filt[1] ? nz(_upward[1]) + 1 : _filt < _filt[1] ? 0 : nz(_upward[1])
    _downward           :=                                                                                                                  _filt < _filt[1] ? nz(_downward[1]) + 1 : _filt > _filt[1] ? 0 : nz(_downward[1])
    [_smoothrng,_filt,_upward,_downward]
[smoothrng, filt, upward, downward] = Range_filter(src, per_, mult)
hband                   =                                                                                                                   filt + smoothrng
lband                   =                                                                                                                   filt - smoothrng
L_RF                    :=                                                      high > hband and upward > 0
S_RF                    :=                                                      low < lband and downward > 0


// Volume -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Volume_condt            =                                                       volume > sma(volume,sma_length)*volume_f
Volume_condt1           =                                                       volume > sma(volume,sma_length1)*volume_f1


//STRATEGY ==========================================================================================================================================================================================================================================================================================================

var bool longCond = na, var bool shortCond = na
var int CondIni_long = 0, var int CondIni_short = 0
var bool _Final_longCondition = na, var bool _Final_shortCondition = na
var float last_open_longCondition = na, var float last_open_shortCondition = na
var int last_longCondition = na, var int last_shortCondition = na
var int last_Final_longCondition = na, var int last_Final_shortCondition = na
var int nLongs = na, var int nShorts = na

L_1     =                                                                       L_adx and Volume_condt  and L_RF and L_ema
S_1     =                                                                       S_adx and Volume_condt  and S_RF and S_ema

L_2     =                                                                       L_adx and  L_RF and L_ema and Volume_condt1
S_2     =                                                                       S_adx and  S_RF and S_ema and Volume_condt1

L_basic_condt       =         L_1 or L_2
S_basic_condt       =         S_1 or S_2

longCond                :=                                                      L_basic_condt
shortCond               :=                                                      S_basic_condt

CondIni_long                := longCond[1]              ? 1 :                   shortCond[1] ? -1 :                             nz(CondIni_long[1]                                          )
CondIni_short               := longCond[1]              ? 1 :                   shortCond[1] ? -1 :                             nz(CondIni_short[1]                                         )
longCondition               = (longCond[1]              and                                                                     nz(CondIni_long[1])                 == -1                   )
shortCondition              = (shortCond[1]             and                                                                     nz(CondIni_short[1])                ==  1                   )

//POSITION PRICE-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var float sum_long = 0.0, var float sum_short = 0.0
var float Position_Price = 0.0

last_open_longCondition     :=                      longCondition               ? close[1]      : nz(last_open_longCondition[1]                     )
last_open_shortCondition    :=                      shortCondition              ? close[1]      : nz(last_open_shortCondition[1]                    )
last_longCondition          :=                      longCondition               ? time          : nz(last_longCondition[1]                          )
last_shortCondition         :=                      shortCondition              ? time          : nz(last_shortCondition[1]                         )
in_longCondition            =                       last_longCondition          >           last_shortCondition
in_shortCondition           =                       last_shortCondition         >           last_longCondition
last_Final_longCondition    :=                      longCondition               ? time                                                  :    nz(last_Final_longCondition[1]                 )
last_Final_shortCondition   :=                      shortCondition              ? time                                                  :    nz(last_Final_shortCondition[1]                )
nLongs                      :=                      nz(nLongs[1]                                                                                                                            )
nShorts                     :=                      nz(nShorts[1]                                                                                                                           )
if longCondition
    nLongs                  :=                      nLongs                      + 1
    nShorts                 := 0
    sum_long                :=                      nz(last_open_longCondition) +           nz(sum_long[1])
    sum_short               := 0.0
if shortCondition
    nLongs                  := 0
    nShorts                 :=                      nShorts + 1
    sum_short               :=                      nz(last_open_shortCondition)+ nz(sum_short[1])
    sum_long                := 0.0
    
Position_Price              :=                      nz(Position_Price[1])

Position_Price              :=                      longCondition               ?       sum_long/nLongs         :       shortCondition      ?       sum_short/nShorts       :       na

//TP---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

var bool long_tp = na, var bool short_tp = na
var int last_long_tp = na, var int last_short_tp = na
var bool Final_Long_tp = na, var bool Final_Short_tp = na
var bool Final_Long_sl0 = na, var bool Final_Short_sl0 = na
var bool Final_Long_sl = na, var bool Final_Short_sl = na
var int last_long_sl = na, var int last_short_sl = na

tp_long             =       ((nLongs  > 1)              ?                       tp_long0  / nLongs              :           tp_long0)                       / 100
tp_short            =       ((nShorts > 1)              ?                       tp_short0 / nShorts             :           tp_short0)                      / 100
long_tp             := high                             >                       (fixnan(Position_Price)         *           (1 + tp_long))                  and                 in_longCondition
short_tp            := low                              <                       (fixnan(Position_Price)         *           (1 - tp_short))                 and                 in_shortCondition
last_long_tp        :=      long_tp                     ?                       time : nz(last_long_tp[1])
last_short_tp       :=      short_tp                    ?                       time : nz(last_short_tp[1])
Final_Long_tp       :=      (long_tp                    and                     last_longCondition              >           nz(last_long_tp[1])             and                 last_longCondition  > nz(last_long_sl[1]))
Final_Short_tp      :=      (short_tp                   and                     last_shortCondition             >           nz(last_short_tp[1])            and                 last_shortCondition > nz(last_short_sl[1]))
L_tp                 =      iff(Final_Long_tp,                                  fixnan(Position_Price)          *           (1 + tp_long)                   ,                   na) 
S_tp                 =      iff(Final_Short_tp,                                 fixnan(Position_Price)          *           (1 - tp_short)                  ,                   na) 

//TP SIGNALS--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

tplLevel            = (in_longCondition                 and 
                      (last_longCondition               >                       nz(last_long_tp[1]))            and 
                      (last_longCondition               >                       nz(last_long_sl[1]))            and not Final_Long_sl[1])                   ? 
                      (nLongs > 1)                      ? 
                      (fixnan(Position_Price)           *                       (1 + tp_long))                  :               (last_open_longCondition    *              (1 + tp_long)) : na
tpsLevel            = (in_shortCondition                and 
                      (last_shortCondition              >                       nz(last_short_tp[1]))           and 
                      (last_shortCondition              >                       nz(last_short_sl[1]))           and not Final_Short_sl[1])                  ? 
                      (nShorts > 1)                     ? 
                      (fixnan(Position_Price)           *                       (1 - tp_short))                 :               (last_open_shortCondition   *             (1 - tp_short)) : na

//SL ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Risk                = sl0
Percent_Capital     = 99

sl                  =  in_longCondition  ?  min(sl0,(((Risk) * 100) / (Percent_Capital *  max(1, nLongs))))  : 
                       in_shortCondition ?  min(sl0,(((Risk) * 100) / (Percent_Capital *  max(1, nShorts)))) : sl0
                       
Normal_long_sl      =               ((in_longCondition                and low                             <= ((1 - (sl / 100))    *               (fixnan(Position_Price)))))
Normal_short_sl     =               ((in_shortCondition               and high                            >= ((1 + (sl / 100))    *               (fixnan(Position_Price)))))  
last_long_sl        :=              Normal_long_sl      ? time : nz(last_long_sl[1])
last_short_sl       :=              Normal_short_sl     ? time : nz(last_short_sl[1])
Final_Long_sl       :=              Normal_long_sl      and last_longCondition              > nz(last_long_sl[1])               and last_longCondition  > nz(last_long_tp[1])  and not Final_Long_tp
Final_Short_sl      :=              Normal_short_sl     and last_shortCondition             > nz(last_short_sl[1])              and last_shortCondition > nz(last_short_tp[1]) and not Final_Short_tp

//RE-ENTRY ON TP-HIT-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

if Final_Long_tp                    or                                          Final_Long_sl
    CondIni_long    :=                                                          -1
    sum_long        :=                                                          0.0
    nLongs          :=                                                          na
    
if Final_Short_tp                   or                                          Final_Short_sl
    CondIni_short   :=                                                          1
    sum_short       :=                                                          0.0
    nShorts         :=                                                          na


// Colors ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Bar_color = in_longCondition ? #009688 : in_shortCondition ? #f06292 : color.orange
barcolor                                                                        (color = Bar_color)

//PLOTS==============================================================================================================================================================================================================================================================================================================

plot(L_tp,                                                  title = "TP_L",                 style = plot.style_cross,                                                                 color = color.fuchsia,                          linewidth = 7   )
plot(S_tp,                                                  title = "TP_S",                 style = plot.style_cross,                                                                 color = color.fuchsia,                          linewidth = 7   )

//Price plots ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

plot((nLongs > 1) or (nShorts > 1) ? Position_Price : na, title = "Price", color = in_longCondition ? color.aqua : color.orange, linewidth = 2, style = plot.style_cross)
plot(tplLevel,                      title="Long TP ",               style = plot.style_cross,                                                                   color=color.fuchsia,                                                                                      linewidth = 1               )
plot(tpsLevel,                      title="Short TP ",              style = plot.style_cross,                                                                   color=color.fuchsia,                                                                                        linewidth = 1               )

//PLOTSHAPES----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


plotshape(Final_Long_tp,            title="TP Long Signal",         style = shape.triangledown,                     location=location.abovebar,                         color=color.red,            size=size.tiny ,          text="TP",             textcolor=color.red,               transp = 0                  ) 
plotshape(Final_Short_tp,           title="TP Short Signal",        style = shape.triangleup,                     location=location.belowbar,                         color=color.green,          size=size.tiny ,            text="TP",           textcolor=color.green,             transp = 0                  ) 

plotshape(longCondition,            title="Long",                   style=shape.triangleup,                 location=location.belowbar,                         color=color.blue,           size=size.tiny ,                                                           transp = 0                  )
plotshape(shortCondition,           title="Short",                  style=shape.triangledown,               location=location.abovebar,                         color=color.red,            size=size.tiny ,                                                           transp = 0                  )


// Backtest  ==================================================================================================================================================================================================================================================================================================================================

if                                                                              L_basic_condt
    strategy.entry                                                              ("LONG", strategy.long )
if                                                                              S_basic_condt
    strategy.entry                                                              ("SHORT", strategy.short )
    
    
strategy.exit("TP_L", "LONG", profit = (abs((last_open_longCondition  * (1 + tp_long)) - last_open_longCondition) / syminfo.mintick), limit = nLongs >= 1 ? strategy.position_avg_price * (1 + tp_long) : na, loss = (abs((last_open_longCondition*(1-(sl/100)))-last_open_longCondition)/syminfo.mintick))

strategy.exit("TP_S", "SHORT", profit = (abs((last_open_shortCondition * (1 - tp_short)) - last_open_shortCondition) / syminfo.mintick), limit = nShorts >= 1 ? strategy.position_avg_price*(1-(tp_short)) : na, loss     = (abs((last_open_shortCondition*(1+(sl/100)))-last_open_shortCondition)/syminfo.mintick))



//By BabehDyo











আরো