//Trend ub = low > center ? 1 : 0 db = high < center ? 1 : 0 trend = sma(ub, pcbars) == 1 ? 1 : sma(db, pcbars) == 1 ? -1 : trend[1]
//Body body = abs(close - open) abody = sma(body, 10)
//Signals up = trend == 1 and (close < open or usecol == false) and (body > abody / 5 or usebod == false) dn = trend == -1 and (close > open or usecol == false) and (body > abody / 5 or usebod == false)
//alert (не работает не выводится в окно напоминалок) alertcondition(up, title="LG", message="в Лонг") alertcondition(dn, title="SH", message="В шорт")
//Lines plot(center, color = blue, linewidth = 3, transp = 0, title = "PriceChannel Center")
//Background col = needbg == false ? na : trend == 1 ? lime : red bgcolor(col, transp = 80)
//Trading if up strategy.entry("Long", strategy.long, needlong == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if dn strategy.entry("Short", strategy.short, needshort == false ? 0 : na, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
if time > timestamp(toyear, tomonth, today, 23, 59) strategy.close_all()