Candle checker for long/short for scalping/day trading
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SoftKill21

//@version=4
strategy("My Script")
greenCandle = (close > open)
redCandle = (close < open)

//if(close[9] < close[8] and  close[8] < close[7] and close[7] < close[6] and close[6] < close[5] and close[5] < close[4] and close[4] < close[3] and close[3] < close[2] and close[2] < close[1] and close[1] < close)
if(close[11] < close[10] and close[10] < close[9] and close[9] < close[8] and  close[8] < close[7] and close[7] < close[6] and close[6] < close[5] and close[5] < close[4] and close[4] < close[3] and close[3] < close[2] and close[2] < close[1] and close[1] < close)
    strategy.entry("long",1)
if(close[11] > close[10] and close[10] > close[9] and close[9] > close[8] and  close[8] > close[7] and close[7] > close[6]and close[6] > close[5] and close[5] > close[4] and close[4] > close[3] and close[3] > close[2] and close[2] > close[1] and close[1] > close)
    strategy.entry("short",0)

if(redCandle)
    strategy.close("long")
if(greenCandle)
    strategy.close("short")

tp = input(150)
sl = input(50)
strategy.exit("tp/sl","long", loss=sl, profit=tp)
strategy.exit("tp/sl","short", loss=sl, profit=tp)