Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
21 kB
0
Indexable
Never
//@version=5
indicator("Reversal Candle Patterns", overlay=true)

atr_borderline                 = input(0.12)
atr_minimum_candle_size        = input(0.9)
plus_minus                     = input(0.0)
minimum_volume                 = input(0)
rsi_correlation                = input(true)
trending                       = input(true)
rsi_addition                   = input(0)
ema_length                     = input(50)
atr_length                     = input(14)
rsi_length                     = input(7)

atr=ta.atr(atr_length)
ema=ta.ema(close, ema_length)
rsi=ta.rsi(close, rsi_length)

b61_ok        = true,        b51_ok        = true,        b41_ok        = true,        b31_ok        = true
r61_ok        = true,        r51_ok        = true,        r41_ok        = true,        r31_ok        = true
b62_ok        = true,        b52_ok        = true,        b42_ok        = true,        b32_ok        = true
r62_ok        = true,        r52_ok        = true,        r42_ok        = true,        r32_ok        = true
b63_ok        = true,        b53_ok        = true,        b43_ok        = true,        b21_ok        = true
r63_ok        = true,        r53_ok        = true,        r43_ok        = true,        r21_ok        = true
b64_ok        = true,        b54_ok        = true,        b44_ok        = true
r64_ok        = true,        r54_ok        = true,        r44_ok        = true
b65_ok        = true,        b55_ok        = true
r65_ok        = true,        r55_ok        = true
b66_ok        = true
r66_ok        = true

c1=close,c2=close[1],c3=close[2],o1=open,o2=open[1],o3=open[2],h1=high,h2=high[1],h3=high[2],l1=low,l2=low[1],l3=low[2]
c4=close[3],c5=close[4],c6=close[5],o4=open[3],o5=open[4],o6=open[5],h4=high[3],h5=high[4],h6=high[5],l4=low[3],l5=low[4],l6=low[5]


var bool overbought_ok = false
if rsi_correlation and rsi>(50+rsi_addition)
    overbought_ok := true
else
    overbought_ok := false

if not rsi_correlation
    overbought_ok := true

var bool uptrending_ok = false
if trending and c1>ema
    uptrending_ok := true   
else
    uptrending_ok := false

if not trending
    uptrending_ok := true    



var bool oversold_ok = false
if rsi_correlation and rsi<(50+rsi_addition)
    oversold_ok := true   
else
    oversold_ok := false

if not rsi_correlation
    oversold_ok := true   

var bool downtrending_ok = false
if trending and c1<ema
    downtrending_ok := true
else
    downtrending_ok := false

if not trending
    downtrending_ok := true   

volume_ok = volume>minimum_volume

b616 = (o6>c6)
b615 = (o5>c5)
b614 = ((o6-c6)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o5-c5)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr)))
b613 = ((c3-o3)>(atr_borderline*atr))
b612 = ((c2-o2)>(atr_borderline*atr))
b611 = (c1>o6-(o6-c6)*plus_minus)and(((c1-o1)>(c2-o2))or((c1-o1)>(c3-o3)))
b61 = b616 and b615 and b614 and b613 and b612 and b611 and volume_ok and b61_ok
r616 = (c6>o6)
r615 = (c5>o5)
r614 = ((c6-o6)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c5-o5)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr)))
r613 = ((o3-c3)>(atr_borderline*atr))
r612 = ((o2-c2)>(atr_borderline*atr))
r611 = (c1<o6+(c6-o6)*plus_minus)and(((o1-c1)>(o2-c2))or((o1-c1)>(o3-c3)))
r61 = r616 and r615 and r614 and r613 and r612 and r611 and volume_ok and r61_ok
b626 = (o6>c6)
b625 = (((o6-c6)>(atr_minimum_candle_size*atr))and((o5-c5)>(atr_borderline*atr))) or (((o5-c5)>(atr_minimum_candle_size*atr))and((o6-c6)>(atr_borderline*atr))) 
b624 = (((c4-o4)<(atr_borderline*atr))and((c4-o4)>(0)))or(((o4-c4)<(atr_borderline*atr))and((o4-c4)>(0)))
b623 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b622 = ((c2-o2)>(atr_borderline*atr))
b621 = (c1>o6-(o6-c6)*plus_minus)and(((c1-o1)>(c2-o2)))
b62 = b626 and b625 and b624 and b623 and b622 and b621 and volume_ok and b62_ok
r626 = (c6>o6)
r625 = (((c6-o6)>(atr_minimum_candle_size*atr))and((c5-o5)>(atr_borderline*atr))) or (((c5-o5)>(atr_minimum_candle_size*atr))and((c6-o6)>(atr_borderline*atr))) 
r624 = (((c4-o4)<(atr_borderline*atr))and((c4-o4)>(0)))or(((o4-c4)<(atr_borderline*atr))and((o4-c4)>(0)))
r623 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r622 = ((o2-c2)>(atr_borderline*atr))
r621 = (c1<o6+(c6-o6)*plus_minus)and(((o1-c1)>(o2-c2)))
r62 = r626 and r625 and r624 and r623 and r622 and r621 and volume_ok and r62_ok
b636 = (o6>c6)
b635 = (o5>c5)
b634 = ((o6-c6)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o5-c5)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr)))
b633 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b632 = ((c2-o2)>(atr_borderline*atr))
b631 = (c1>o6-(o6-c6)*plus_minus)and(((c1-o1)>(c2-o2)))
b63 = b636 and b635 and b634 and b633 and b632 and b631 and volume_ok and b63_ok
r636 = (c6>o6)
r635 = (c5>o5)
r634 = ((c6-o6)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c5-o5)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr)))
r633 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r632 = ((o2-c2)>(atr_borderline*atr))
r631 = (c1<o6+(c6-o6)*plus_minus)and(((o1-c1)>(o2-c2)))
r63 = r636 and r635 and r634 and r633 and r632 and r631 and volume_ok and r63_ok
b646 = (o6>c6)
b645 = (o5>c5)
b644 = (o4>c4)
b643 = ((o6-c6)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o6-c6)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr)))
b642 = ((c2-o2)>(atr_borderline*atr))
b641 = (c1>o6-(o6-c6)*plus_minus)and(((c1-o1)>(c2-o2)))
b64 = b646 and b645 and b644 and b643 and b642 and b641 and volume_ok and b64_ok
r646 = (c6>o6)
r645 = (c5>o5)
r644 = (c4>o4)
r643 = ((c6-o6)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c6-o6)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr)))
r642 = ((o2-c2)>(atr_borderline*atr))
r641 = (c1<o6+(c6-o6)*plus_minus)and(((o1-c1)>(o2-c2)))
r64 = r646 and r645 and r644 and r643 and r642 and r641 and volume_ok and r64_ok
b656 = (o6>c6)
b655 = (o5>c5)
b654 = ((o6-c6)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o5-c5)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr)))
b653 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b652 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b651 = (c1>o6-(o6-c6)*plus_minus)
b65 = b656 and b655 and b654 and b653 and b652 and b651 and volume_ok and b65_ok
r656 = (c6>o6)
r655 = (c5>o5)
r654 = ((c6-o6)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c5-o5)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr)))
r653 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r652 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r651 = (c1<o6+(c6-o6)*plus_minus)
r65 = r656 and r655 and r654 and r653 and r652 and r651 and volume_ok and r65_ok
b666 = (o6>c6)
b665 = (o5>c5)
b664 = (o4>c4)
b663 = ((o6-c6)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o6-c6)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o6-c6)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr)))
b662 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b661 = (c1>o6-(o6-c6)*plus_minus)
b66 = b666 and b665 and b664 and b663 and b662 and b661 and volume_ok and b66_ok
r666 = (c6>o6)
r665 = (c5>o5)
r664 = (c4>o4)
r663 = ((c6-o6)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c6-o6)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c6-o6)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr)))
r662 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r661 = (c1<o6+(c6-o6)*plus_minus)
r66 = r666 and r665 and r664 and r663 and r662 and r661 and volume_ok and r66_ok
b515 = (o5>c5)
b514 = (o4>c4)
b513 = ((o5-c5)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o3-c3)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o5-c5)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr)))
b512 = ((c2-o2)>(atr_borderline*atr))
b511 = (c1>o5-(o5-c5)*plus_minus)and((c1-o1)>(c2-o2))
b51 =  b515 and b514 and b513 and b512 and b511 and volume_ok and b51_ok
r515 = (c5>o5)
r514 = (c4>o4)
r513 = ((c5-o5)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c3-o3)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c5-o5)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr)))
r512 = ((o2-c2)>(atr_borderline*atr))
r511 = (c1<o5+(c5-o5)*plus_minus)and((o1-c1)>(o2-c2))
r51 =  r515 and r514 and r513 and r512 and r511 and volume_ok and r51_ok
b525 = (o5>c5)
b524 = (((o5-c5)>(atr_minimum_candle_size*atr))and((o4-c4)>(atr_borderline*atr))) or (((o4-c4)>(atr_minimum_candle_size*atr))and((o5-c5)>(atr_borderline*atr))) 
b523 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b522 = ((c2-o2)>(atr_borderline*atr))
b521 = (c1>o5-(o5-c5)*plus_minus)and((c1-o1)>(c2-o2))
b52 =  b525 and b524 and b523 and b522 and b521 and volume_ok and b52_ok
r525 = (c5>o5)
r524 = (((c4-o4)>(atr_minimum_candle_size*atr))and((c5-o5)>(atr_borderline*atr))) or (((c4-o4)>(atr_minimum_candle_size*atr))and((c5-o5)>(atr_borderline*atr))) 
r523 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r522 = ((o2-c2)>(atr_borderline*atr))
r521 = (c1<o5+(c5-o5)*plus_minus)and(((o1-c1)>(o2-c2)))
r52 =  r525 and r524 and r523 and r522 and r521 and volume_ok and r52_ok
b535 = (o5>c5)
b534 = (((o5-c5)>(atr_minimum_candle_size*atr))and((o4-c4)>(atr_borderline*atr))) or (((o4-c4)>(atr_minimum_candle_size*atr))and((o5-c5)>(atr_borderline*atr))) 
b533 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b532 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b531 = (c1>o5-(o5-c5)*plus_minus)
b53 =  b535 and b534 and b533 and b532 and b531 and volume_ok and b53_ok
r535 = (c5>o5)
r534 = (((c4-o4)>(atr_minimum_candle_size*atr))and((c5-o5)>(atr_borderline*atr))) or (((c5-o5)>(atr_minimum_candle_size*atr))and((c4-o4)>(atr_borderline*atr))) 
r533 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r532 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r531 = (c1<o5+(c5-o5)*plus_minus)
r53 =  r535 and r534 and r533 and r532 and r531 and volume_ok and r53_ok
b545 = (o5>c5)
b544 = (o4>c4)
b543 = ((o5-c5)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o3-c3)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o5-c5)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr)))
b542 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b541 = (c1>o5-(o5-c5)*plus_minus)
b54 =  b545 and b544 and b543 and b542 and b541 and volume_ok and b54_ok
r545 = (c5>o5)
r544 = (c4>o4)
r543 = ((c5-o5)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c3-o3)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c5-o5)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr)))
r542 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r541 = (c1<o5+(c5-o5)*plus_minus)
r54 =  r545 and r544 and r543 and r542 and r541 and volume_ok and r54_ok
b555 = (o5>c5)
b554 = (o4>c4)
b553 = (o3>c3)
b552 = ((o2-c2)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o5-c5)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o2-c2)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o2-c2)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o2-c2)>(atr_borderline*atr))and((o4-c4)>(atr_borderline*atr))and((o5-c5)>(atr_borderline*atr)))
b551 = (c1>o5-(o5-c5)*plus_minus)
b55 =  b555 and b554 and b553 and b552 and b551 and volume_ok and b55_ok
r555 = (c5>o5)
r554 = (c4>o4)
r553 = (c3>o3)
r552 = ((c2-o2)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c5-o5)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c2-o2)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c2-o2)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c2-o2)>(atr_borderline*atr))and((c4-o4)>(atr_borderline*atr))and((c5-o5)>(atr_borderline*atr)))
r551 = (c1<o5+(c5-o5)*plus_minus)
r55 =  r555 and r554 and r553 and r552 and r551 and volume_ok and r55_ok
b414 = (o4>c4)
b413 = (((o3-c3)>(atr_minimum_candle_size*atr))and((o4-c4)>(atr_borderline*atr))) or (((o4-c4)>(atr_minimum_candle_size*atr))and((o3-c3)>(atr_borderline*atr))) 
b412 = ((c2-o2)>(atr_borderline*atr))
b411 = (c1>o4-(o4-c4)*plus_minus)and((c1-o1)>(c2-o2))
b41 =  b414 and b413 and b412 and b411 and volume_ok and b41_ok
r414 = (c4>o4)
r413 = (((c4-o4)>(atr_minimum_candle_size*atr))and((c3-o3)>(atr_borderline*atr))) or (((c4-o4)>(atr_minimum_candle_size*atr))and((c3-o3)>(atr_borderline*atr))) 
r412 = ((o2-c2)>(atr_borderline*atr))
r411 = (c1<o4+(c4-o4)*plus_minus)and((o1-c1)>(o2-c2))
r41 =  r414 and r413 and r412 and r411 and volume_ok and r41_ok
b424 = ((o4-c4)>(atr_minimum_candle_size*atr))
b423 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
b422 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b421 = (c1>o4-(o4-c4)*plus_minus)
b42 =  b424 and b423 and b422 and b421 and volume_ok and b42_ok
r424 = ((c4-o4)>(atr_minimum_candle_size*atr))
r423 = (((c3-o3)<(atr_borderline*atr))and((c3-o3)>(0)))or(((o3-c3)<(atr_borderline*atr))and((o3-c3)>(0)))
r422 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r421 = (c1<o4+(c4-o4)*plus_minus)
r42 =  r424 and r423 and r422 and r421 and volume_ok and r42_ok
b434 = (o4>c4)
b433 = (((o3-c3)>(atr_minimum_candle_size*atr))and((o4-c4)>(atr_borderline*atr))) or (((o4-c4)>(atr_minimum_candle_size*atr))and((o3-c3)>(atr_borderline*atr))) 
b432 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
b431 = (c1>o4-(o4-c4)*plus_minus)
b43 =  b434 and b433 and b432 and b431 and volume_ok and b43_ok
r434 = (c4>o4)
r433 = (((c4-o4)>(atr_minimum_candle_size*atr))and((c3-o3)>(atr_borderline*atr))) or (((c4-o4)>(atr_minimum_candle_size*atr))and((c3-o3)>(atr_borderline*atr))) 
r432 = (((c2-o2)<(atr_borderline*atr))and((c2-o2)>(0)))or(((o2-c2)<(atr_borderline*atr))and((o2-c2)>(0)))
r431 = (c1<o4+(c4-o4)*plus_minus)
r43 =  r434 and r433 and r432 and r431 and volume_ok and r43_ok
b444 = (o4>c4)
b443 = (o3>c3)
b442 = ((o2-c2)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o3-c3)>(atr_borderline*atr))) or ((o3-c3)>(atr_minimum_candle_size*atr)and((o4-c4)>(atr_borderline*atr))and((o2-c2)>(atr_borderline*atr))) or ((o4-c4)>(atr_minimum_candle_size*atr)and((o3-c3)>(atr_borderline*atr))and((o2-c2)>(atr_borderline*atr)))
b441 = (c1>o4-(o4-c4)*plus_minus)
b44 =  b444 and b443 and b442 and b441 and volume_ok and b44_ok
r444 = (c4>o4)
r443 = (c3>o3)
r442 = ((c2-o2)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c3-o3)>(atr_borderline*atr))) or ((c3-o3)>(atr_minimum_candle_size*atr)and((c4-o4)>(atr_borderline*atr))and((c2-o2)>(atr_borderline*atr))) or ((c4-o4)>(atr_minimum_candle_size*atr)and((c3-o3)>(atr_borderline*atr))and((c2-o2)>(atr_borderline*atr)))
r441 = (c1<o4+(c4-o4)*plus_minus)
r44 =  r444 and r443 and r442 and r441 and volume_ok and r44_ok
b313 = (o3>c3)
b312 = (((o3-c3)>(atr_minimum_candle_size*atr))and((o2-c2)>(atr_borderline*atr))) or (((o2-c2)>(atr_minimum_candle_size*atr))and((o3-c3)>(atr_borderline*atr))) 
b311 = (c1>o3-(o3-c3)*plus_minus)
b31 =  b313 and b312 and b311 and volume_ok and b31_ok
r313 = (c3>o3)
r312 = (((c3-o3)>(atr_minimum_candle_size*atr))and((c2-o2)>(atr_borderline*atr))) or (((c2-o2)>(atr_minimum_candle_size*atr))and((c3-o3)>(atr_borderline*atr))) 
r311 = (c1<o3+(c3-o3)*plus_minus)
r31 = r313 and r312 and r311 and volume_ok and r31_ok
b323 = ((o3-c3)>(atr_minimum_candle_size*atr))
b322 = ((o2>c2)and((o2-c2)<(atr_borderline*atr))) or ((c2>o2)and((c2-o2)<(atr_borderline*atr)))
b321 = (c1>o3-(o3-c3)*plus_minus)
b32 =  b323 and b322 and b321 and volume_ok and b32_ok
r323 = ((c3-o3)>(atr_minimum_candle_size*atr))
r322 = ((c2>o2)and((c2-o2)<(atr_borderline*atr))) or ((c2<o2)and((o2-c2)<(atr_borderline*atr)))
r321 = (c1<o3+(c3-o3)*plus_minus)
r32 =  r323 and r322 and r321 and volume_ok and r32_ok
b212 = ((o2-c2)>atr) and (((h2-o2)<((o2-c2)/2))or((h2-o2)<((c2-l2)/2))) 
b211 = (c1>o2-(o2-c2)*plus_minus) and (((h1-c1)<((c1-o1)/2))or((h1-c1)<((o1-l1)/2))) 
b21 =  b212 and b211 and volume_ok and b21_ok
r212 = ((c2-o2)>atr) and (((o2-l2)<((c2-o2)/2))or((o2-l2)<((h2-c2)/2))) 
r211 = (c1<o2+(c2-o2)*plus_minus) and (((c1-l1)<((o1-c1)/2))or((c1-l1)<((h1-o1)/2))) 
r21 =  r212 and r211 and volume_ok and r21_ok
plotshape((b61 or b62 or b63 or b64 or b65 or b66 or b51 or b52 or b53 or b54 or b55 or b41 or b42 or b43 or b44 or b31 or b32 or b21) and overbought_ok and uptrending_ok, style = shape.triangleup, location = location.belowbar, color=color.green, size = size.small)
plotshape((r61 or r62 or r63 or r64 or r65 or r66 or r51 or r52 or r53 or r54 or r55 or r41 or r42 or r43 or r44 or r31 or r32 or r21) and oversold_ok and downtrending_ok, style = shape.triangledown, location = location.abovebar, color=color.red, size = size.small)
Leave a Comment