20% up with all continuously green candle: Lovevanshi 
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Lovevanshi

//@version=4
study("20% up with all continuously green candle: Lovevanshi ",shorttitle="20%Up_G_L", overlay=true)
int a=0
gain=0.0
max=0.0
u=0
min=1000000.0
d=0
signal=array.new_bool(1000,false)
greenCandle = (close > open) or (close==open and open>low[1])

//if statement to check continuous candle are green
if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14] and greenCandle[a+15] and greenCandle[a+16] and greenCandle[a+17] and greenCandle[a+18] and greenCandle[a+19]

    i=for i=a to a+19


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+19
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14] and greenCandle[a+15] and greenCandle[a+16] and greenCandle[a+17] and greenCandle[a+18]

    i=for i=a to a+18


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+18
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14] and greenCandle[a+15] and greenCandle[a+16] and greenCandle[a+17]

    i=for i=a to a+17


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+17
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14] and greenCandle[a+15] and greenCandle[a+16]

    i=for i=a to a+16


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+16
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14] and greenCandle[a+15]

    i=for i=a to a+15


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+15
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13] and greenCandle[a+14]

    i=for i=a to a+14


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+14
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles

else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12] and greenCandle[a+13]

    i=for i=a to a+13


        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+13
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11] and greenCandle[a+12]
    i=for i=a to a+12

        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+12
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles

else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10] and greenCandle[a+11]

    i=for i=a to a+11

        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+11
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]  and greenCandle[a+10]
    i=for i=a to a+10
        if max<high[i]      
            max:=high[i]    // to get maximum of high among continuously green candles
            u:=i            // to get bar_index of maximum of high among continuously green candles
    j=for j=a to a+10
        if min>low[j]
            min:=low[j]      // to get minimum of low among green candles
            d:=j            // to get bar_index of minimum of low among continuously green candle
    gain:=(high[u]-low[d])/low[d]   //ratio of difference between maximum high and minimum low with respect to minimum low among continuously green candles
    if gain>0.2
        array.insert(signal, a, true) //enter "true" after checking if gain is more than 20% amonng continuously green candles
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]  and greenCandle[a+9]
    i=for i=a to a+9
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+9
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7] and greenCandle[a+8]
    i=for i=a to a+8
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+8
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6] and greenCandle[a+7]
    i=for i=a to a+7
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+7
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5] and greenCandle[a+6]
    i=for i=a to a+6
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+6
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4] and greenCandle[a+5]
    i=for i=a to a+5
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+5
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3] and greenCandle[a+4]
    i=for i=a to a+4
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+4
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2] and greenCandle[a+3]
    i=for i=a to a+3
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+3
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true and greenCandle[a+2]
    i=for i=a to a+2
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+2
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true and greenCandle[a+1]==true
    i=for i=a to a+1
        if max<high[i]
            max:=high[i]
            u:=i
    j=for j=a to a+1
        if min>low[j]
            min:=low[j]
            d:=j
    gain:=(high[u]-low[d])/low[d]
    if gain>0.2
        array.insert(signal, a, true)
else if greenCandle[a]==true
    gain:=(high[a]-low[a])/low[a]
    if gain>0.2
        array.insert(signal, a, true)
plotshape(array.get(signal,a), style=shape.triangleup, location=location.abovebar, color=color.green,size=size.small) // to plot triangle at the top of a bar if signal is "true"
