countTradingDays = na countNonTradingDays = na countTradingDays := strategy.position_size==0 ? 0 : countTradingDays[1] + 1 countNonTradingDays := strategy.position_size!=0 ? 0 : countNonTradingDays[1] + 1 entry1 = close entry2 = close entry3 = close entry4 = close entry1 := strategy.position_size==0 ? na : entry1[1] entry2 := strategy.position_size==0 ? na : entry2[1] entry3 := strategy.position_size==0 ? na : entry3[1] entry4 := strategy.position_size==0 ? na : entry4[1] lo2 = close lo3 = close lo4 = close lo2 := strategy.position_size==0 ? na : lo2[1] lo3 := strategy.position_size==0 ? na : lo3[1] lo4 := strategy.position_size==0 ? na : lo4[1] losscut = close losscut := strategy.position_size==0 or SO_bool==false ? na : losscut[1]
L_EntrySig = close >= UPPER and isWork S_EntrySig = close <= LOWER and isWork
if(strategy.position_size != 0) L_ExitSig = (close <= EMA or S_EntrySig) and strategy.position_size > 0 S_ExitSig = (close >= EMA or L_EntrySig) and strategy.position_size < 0
TimedSig = countTradingDays > Tm_len and Tm_bool strategy.close_all(when = L_ExitSig or S_ExitSig or TimedSig or not isWork)
if(L_ExitSig or S_ExitSig) entry1 := na entry2 := na entry3 := na entry4 := na lo2 := na lo3 := na lo4 := na losscut := na
if(strategy.position_size > 0) lo_sig2 = lo2 < high lo_sig3 = lo3 < high lo_sig4 = lo4 < high
if(lo_sig2 and MAX_N >= 2) if(SO_bool) strategy.entry("L-Entry2" ,strategy.long ,stop=close-atr_SO ,comment="L-Entry2") strategy.exit("L-Entry1" ,stop=close-atr_SO) else strategy.entry("L-Entry2" ,strategy.long ,comment="L-Entry2") lo2 := na losscut := SO_bool ? close - atr_SO : na if(lo_sig3 and MAX_N >= 3) if(SO_bool) strategy.entry("L-Entry3" ,strategy.long ,stop=close-atr_SO ,comment="L-Entry3") strategy.exit("L-Entry2" ,stop=close-atr_SO) strategy.exit("L-Entry1" ,stop=close-atr_SO) else strategy.entry("L-Entry3" ,strategy.long ,comment="L-Entry3") lo3 := na losscut := SO_bool ? close - atr_SO : na if(lo_sig4 and MAX_N >= 4) if(SO_bool) strategy.entry("L-Entry4" ,strategy.long ,stop=close-atr_SO ,comment="L-Entry4") strategy.exit("L-Entry3" ,stop=close-atr_SO) strategy.exit("L-Entry2" ,stop=close-atr_SO) strategy.exit("L-Entry1" ,stop=close-atr_SO) else strategy.entry("L-Entry4" ,strategy.long ,comment="L-Entry4") lo4 := na losscut := SO_bool ? close - atr_SO : na
Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.