Trend & atr day & calc
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © EmoeTeam
//@version=5
indicator(title="Trend & ATR daily & calc_rus", shorttitle="TrAtrCalc", overlay=true)

//Дневной ATR

show_trend = input(true, 'Trend', tooltip = "Hide the trends", inline = "Hide / Show")
show_atr = input(true, 'Progress ATR', tooltip = "Hide the trend on the selected timeframe and the progress ATR within the day", inline = "Hide / Show")
show_calc = input.bool (true, "Сalculator RR", tooltip = "Калькулятор больше ориентирован на русскоговорящую аудиторию", inline = "Hide / Show")

color_bull = input.color(color.rgb(48, 150, 51, 10), title = "Bull", inline = "color", group = "✏️ Colour settings for trends")
color_bear = input.color(color.rgb(156, 57, 57, 10), title = "Bear", inline = "color", group = "✏️ Colour settings for trends")
color_net  = input.color(color.rgb(201, 141, 50, 10), title = "Flat", inline = "color", group = "✏️ Colour settings for trends")

//1.1 Получение данных об ATR активного инструмента, с дневного таймфрейма

timeframe = "1D"
atr_day = ta.atr(5)
ticker = ticker.new(syminfo.prefix, syminfo.ticker, session = session.regular)
previous_close = request.security(ticker, "1D", close, gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on)
atr = request.security(ticker, "1D", atr_day, gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on)
period_high = request.security(ticker, "1D", high,gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on)
period_low = request.security(ticker, "1D", low,gaps = barmerge.gaps_off, lookahead = barmerge.lookahead_on)
range_1 = period_high - period_low
tr_percent_of_atr = (range_1 / atr) * 100

//1.2 Расчеты для выделения цветом пройденого дневного ATR

tr_vs_atr_color = color_bull 
if tr_percent_of_atr <= 70 
    tr_vs_atr_color := color_bull 
else if tr_percent_of_atr >= 90 
    tr_vs_atr_color := color_bear
else
    tr_vs_atr_color := color_net

// 1.3 Вывод данных на экран

var note = "Green - there is room for movement within the ATR; Yellow - daytime ATR, almost passed; Red - Ticker has already passed its daily ATR"

var tbl = table.new(position.top_center, 3,3, border_width = 2)

if barstate.islast and show_atr
    //table.cell(tbl, 0, 0, trading_mode, bgcolor = trend_color)
    //table.cell(tbl, 0 ,0, " way " + str.tostring (tr_percent_of_atr, '#.##') + "% " + "($" + str.tostring(range_1, '#.#') + ") " + " daily ATR = $" + str.tostring(atr, '#.##'), bgcolor = tr_vs_atr_color, tooltip = note)
    table.cell(tbl, 0 ,0, " way " + str.tostring (tr_percent_of_atr, '#.##') + "% " + "($" + str.tostring(range_1, '#.#') + ") ", bgcolor = tr_vs_atr_color, tooltip = note, text_size = size.small)
    table.cell(tbl, 0 ,1, " daily ATR = $" + str.tostring(atr, '#.##'), bgcolor = tr_vs_atr_color, tooltip = note, text_size = size.small)
    //table.cell(tbl, 0 ,1, " " )
    //table.cell(tbl, 0 ,2, " " )

// Тренд на разных таймфреймах

// 2.1 Определение тренда на основе индикатора Вильямса

jawLength   = 13
jawOffset   = 8
teethLength = 8
teethOffset = 5
lipsLength  = 5
lipsOffset  = 3
source = hl2

smma(source, lenght) =>
    smma1  =  0.0000
    smma11 =  ta.sma(source, lenght)
    smma1 :=  na(smma1[1]) ? smma11 : ((smma1[1] * (lenght - 1) + source) / lenght)

jawInput = smma(source, jawLength)
jaw_5  = request.security(syminfo.tickerid, "5", jawInput)
jaw_15  = request.security(syminfo.tickerid, "15", jawInput)
jaw_30  = request.security(syminfo.tickerid, "30", jawInput)
jaw_60  = request.security(syminfo.tickerid, "60", jawInput)
jaw_240  = request.security(syminfo.tickerid, "240", jawInput)
jaw_day  = request.security(syminfo.tickerid, "D", jawInput)

teethInput = smma(source, teethLength)
teeth_5 = request.security(syminfo.tickerid, "5", teethInput)
teeth_15 = request.security(syminfo.tickerid, "15", teethInput)
teeth_30 = request.security(syminfo.tickerid, "30", teethInput)
teeth_60 = request.security(syminfo.tickerid, "60", teethInput)
teeth_240 = request.security(syminfo.tickerid, "240", teethInput)
teeth_day = request.security(syminfo.tickerid, "D", teethInput)

lipsInput = smma(source, lipsLength)
lips_5 = request.security(syminfo.tickerid, "5", lipsInput)
lips_15 = request.security(syminfo.tickerid, "15", lipsInput)
lips_30 = request.security(syminfo.tickerid, "30", lipsInput)
lips_60 = request.security(syminfo.tickerid, "60", lipsInput)
lips_240 = request.security(syminfo.tickerid, "240", lipsInput)
lips_day = request.security(syminfo.tickerid, "D", lipsInput)

price_5 = request.security(syminfo.tickerid, "5", close)
price_15 = request.security(syminfo.tickerid, "15", close)
price_30 = request.security(syminfo.tickerid, "30", close)
price_60 = request.security(syminfo.tickerid, "60", close)
price_240 = request.security(syminfo.tickerid, "240", close)
price_day = request.security(syminfo.tickerid, "D", close)

bullish_5 = price_5 >= lips_5 and lips_5 >= teeth_5 and teeth_5 >= jaw_5
bearish_5 = price_5 <= lips_5 and lips_5 <= teeth_5 and teeth_5 <= jaw_5
bullish_15 = price_15 >= lips_15 and lips_15 >= teeth_15 and teeth_15 >= jaw_15
bearish_15 = price_15 <= lips_15 and lips_15 <= teeth_15 and teeth_15 <= jaw_15
bullish_30 = price_30 >= lips_30 and lips_30 >= teeth_30 and teeth_30 >= jaw_30
bearish_30 = price_30 <= lips_30 and lips_30 <= teeth_30 and teeth_30 <= jaw_30
bullish_60 = price_60 >= lips_60 and lips_60 >= teeth_60 and teeth_60 >= jaw_60
bearish_60 = price_60 <= lips_60 and lips_60 <= teeth_60 and teeth_60 <= jaw_60
bullish_240 = price_240 >= lips_240 and lips_240 >= teeth_240 and teeth_240 >= jaw_240
bearish_240 = price_240 <= lips_240 and lips_240 <= teeth_240 and teeth_240 <= jaw_240
bullish_day = price_day >= lips_day and lips_day >= teeth_day and teeth_day >= jaw_day
bearish_day = price_day <= lips_day and lips_day <= teeth_day and teeth_day <= jaw_day

trend_color_5 = bullish_5 ? color_bull : bearish_5 ? color_bear : color_net
trend_color_15 = bullish_15 ? color_bull : bearish_15 ? color_bear : color_net
trend_color_30 = bullish_30 ? color_bull : bearish_30 ? color_bear : color_net
trend_color_60 = bullish_60 ? color_bull : bearish_60 ? color_bear : color_net
trend_color_240 = bullish_240 ? color_bull : bearish_240 ? color_bear : color_net
trend_color_day = bullish_day ? color_bull : bearish_day ? color_bear : color_net

//alertbull_5 = bullish_5
//alertbear_5 = bearish_5
alertany = bullish_5 and bullish_15 or bearish_5 and bearish_15
alertall = bearish_5 and bullish_15 and bullish_30 and bullish_60 or bullish_5 and bearish_15 and bearish_30 and bearish_60

// Вывод данных о трендах на экран

var note1 = "the trend direction on the TF ? - based on Bill Williams' alligator indicator"

var tbl_tr = table.new(position.top_right, 7,7, border_width = 3)
if barstate.islast and show_trend
    table.cell(tbl_tr, 0, 0, "", width = 2.7, height = 2.5)
    table.cell(tbl_tr, 1, 1, "5",  width = 2.7, bgcolor = trend_color_5, text_font_family = font.family_monospace, tooltip = note1)
    table.cell(tbl_tr, 2, 1, "15", width = 2.7, bgcolor = trend_color_15, text_font_family = font.family_monospace, tooltip = note1)
    table.cell(tbl_tr, 3, 1, "30", width = 2.7, bgcolor = trend_color_30, text_font_family = font.family_monospace, tooltip = note1)
    table.cell(tbl_tr, 4, 1, "1H", width = 2.7, bgcolor = trend_color_60, text_font_family = font.family_monospace, tooltip = note1)
    table.cell(tbl_tr, 5, 1, "4H", width = 2.7, bgcolor = trend_color_240, text_font_family = font.family_monospace, tooltip = note1)
    table.cell(tbl_tr, 6, 1, "1D", width = 2.7, bgcolor = trend_color_day, text_font_family = font.family_monospace, tooltip = note1)

///Сигналы
alertcondition(bullish_5, title = "Long 5", message = "Сигнал с 5 ки на лонг")
alertcondition(bearish_5, title = "Short 5", message = "Сигнал с 5ки на шорт")
alertcondition(alertany, title = "5 + 15", message = "Сигнал на 5 и 15 ки - определить направление")
alertcondition(alertall, title = "All", message = "4-ре ТФ в одном направлении ")

///// Калькулятор рисков и позиции /////

// Titles
CALC = '✏️ Калькулятор мани-менеджмент'
OPTIONAL = '✏️ Optional inputs'
SENTIMENT = '✏️ Sentiment'
ATR = '✏️ Atr'
TABLE_SETTINGS = '✏️ Table Settings'

// Tooltips
tt_position = 'Размер счета, а более правльно сколько денег выделяем на 1 сделку. Выберите знак денежной системы, просто для красоты.'
tt_risk = 'Здесь задаем размер максимальной просадки для одной сделки, рекомендуемый диапазон от 0,5% до 5%. Этот показатель должен быть ОДИНАКОВЫМ во всех сделках.'
tt_leverage = 'Размер кредитного плеча'
tt_comission = "Здесь указываем совокупную биржевую (0,01%) и брокерскую комисии. ВТБ онлайн - 0,05% и Мосбиржа (мейкер 0% - тейкер 0,03%) среднее 0,015%"
tt_spread = "Здесь нужно указать предполагаемую величину проскальзывания. Величина приблизительная, поэтому нужно округлять в сторону ее увеличения"
tt_shares = 'В случае, если хотите рассчитать прибыль или стоп-лосс на основе количества акций. Если указано, то ввод \'Capital\' будет проигнорирован'
tt_entry = 'Цена, по которой мы открываем позицию'
tt_stop = 'Цена, где мы закрываем сделку с убытком'
tt_close = 'Цена, при достижении которой мы фиксируем прибыль, а также желаемое отношение риска к прибыли'
tt_important = "Следует отличать риск по позиции и риск по бумаге. Риск по бумаге обычно определяется по графику и представляет собой расстояние от уровня открытия позиции до уровня стоп-заявки. 
 Риск по позиции относит эту величину к размеру депозита трейдера и показывает, какая часть депозита будет потеряна в случае, если позиция закроется с убытком."


i_position = input.int(title='Депозит', minval=1, defval=60000, tooltip=tt_position, inline = 'money', group=CALC)
i_type_money = input.string ("руб", "Валюта", options = ["usd", "руб"], inline = 'money', group=CALC)
i_riskPercent = input.float(title='Риск %', minval=0.25, defval=1, step = 0.25, tooltip=tt_risk + "  " +tt_important, group=CALC)
i_leverage = input.int(title='Кредит', minval=1, defval=1, tooltip=tt_leverage, group=CALC)
i_commisionPercent = input.float(title='Комиссия %', minval=0, defval=0.065, tooltip = tt_comission, group=CALC)
i_pos_type = input.bool (false, "сделка в short", group=CALC, inline='MM')


//Colors
c_posCalcColor = input.color(#d1d4dc, '', inline='MM', group=CALC)
c_posCalcColor1 = input.color(#50450D, '', inline='MM', group=CALC)
c_posCalcColor2 = input.color(#50450D, '', inline='MM', group=CALC)
c_posCalcCol1Bg = input.color(#A89B5B, '', inline='MM', group=CALC)
c_posCalcCol2Bg = input.color(#0E1936, '', inline='MM', group=CALC)
c_posCalcCol3Bg = input.color(#5C6C9B, '', inline='MM', group=CALC)
//c_posCalcPosTypeLong = "👆"
//c_posCalcPosTypeShort = "👇"

//posCalcPosType = i_pos_type ? c_posCalcPosTypeShort : c_posCalcPosTypeLong


//Ввод данных вручную для расчета
i_entryPrice = input.float(0, 'Entry position price', minval=0, step =0.01, tooltip=tt_entry, group=OPTIONAL)
i_stopPrice = input.float(0.3, 'Stop price', minval=0, step =0.01, tooltip=tt_stop, group=OPTIONAL, inline='loss')
i_spread = input.float(title='Размер спреда', minval=0, defval=0.00, tooltip = tt_spread, group=OPTIONAL)
i_takeProfitPrice = input.float(0, 'Take Profit price', step =0.01, minval=0, tooltip=tt_close, inline = 'profit', group=OPTIONAL)

loss_type = input.string("%", "тип", options = ['%', 'цена'], inline='loss', group=OPTIONAL)
profit_X = input.float(3.6, "R/R", options = [2.26, 2.87, 3.6, 4.58, 5.85], inline = 'profit', group=OPTIONAL)
 
///// ВЫЧИСЛЕНИЯ /////
money_symbol = i_type_money == "usd" ? "$" : "р."
type_trade = i_pos_type ? "SHORT ⬇" : "LONG ⬆"

// Вычисляем сколько в деньгах - указанный процент риска
risk_amount = i_position * i_riskPercent / 100 

//Определяем какую цену (точку входа) берем для расчета
entryPrice = i_entryPrice > 0 ? i_entryPrice : close

f_amount(amount) =>
    val = amount > 1 ? str.tostring(amount, '##.##') : str.tostring(amount, '##.#####')
    val


//Вычисляем значение SL
//при long
sl_val0 = loss_type == '%' ? entryPrice - i_stopPrice/100 * entryPrice : i_stopPrice

//при short
sl_val3 = loss_type == '%' ? entryPrice + i_stopPrice/100 * entryPrice : i_stopPrice

sl_val1 = i_pos_type ? sl_val3 : sl_val0
sl_val2 = loss_type == 'цена' ? i_stopPrice * 100 / entryPrice : i_stopPrice

//Описываем символ стопа и выбираем вариант для отображения
Stop = loss_type == '%' and sl_val1 ? " %": money_symbol
Stop_loss = loss_type == '%' and sl_val1 ? money_symbol: " %"
sl_val = math.abs (loss_type == '%' ? sl_val1 : math.round (100 - sl_val2, 2))

//Потенциал потерь (с учетом проскальзывания и комиссий) 
//при сделке в LONG
loss_long = loss_type == 'цена' ? entryPrice * (1+i_commisionPercent/100) - i_stopPrice * (1-i_commisionPercent/100) + i_spread * 2 : entryPrice * (1+i_commisionPercent/100) - sl_val * (1-i_commisionPercent/100) + i_spread * 2

//при сделке в SHORT
loss_short = loss_type == 'цена' ? i_stopPrice * (1+i_commisionPercent/100) - entryPrice * (1-i_commisionPercent/100) + i_spread * 2 : sl_val  * (1+i_commisionPercent/100) - entryPrice * (1-i_commisionPercent/100) + i_spread * 2

loss = i_pos_type ? loss_short : loss_long
loss_perc = math.round (loss / entryPrice * 100, 2)


//Потенциал заработка (с учетом проскальзывания)
size_protit = loss_type == 'цена' ? i_takeProfitPrice : i_stopPrice * profit_X
auto_protit_long = loss_type == 'цена' ? i_takeProfitPrice : entryPrice + (entryPrice * size_protit * 0.01)
auto_protit_short = loss_type == 'цена' ? i_takeProfitPrice : entryPrice - (entryPrice * size_protit * 0.01)
auto_protit = i_pos_type ? auto_protit_short : auto_protit_long

//при сделке в LONG
profit_long = loss_type == 'цена' ? i_takeProfitPrice * (1-i_commisionPercent/100) - entryPrice * (1+i_commisionPercent/100) - i_spread * 2 : auto_protit * (1-i_commisionPercent/100) - entryPrice * (1+i_commisionPercent/100) - i_spread * 2

//при сделке в SHORT
profit_short = loss_type == 'цена' ? entryPrice * (1-i_commisionPercent/100) - i_takeProfitPrice * (1+i_commisionPercent/100) - i_spread * 2 : entryPrice * (1-i_commisionPercent/100) - auto_protit * (1+i_commisionPercent/100) - i_spread * 2

profit = i_pos_type ? profit_short : profit_long
profit_perc = math.round (profit / entryPrice * 100, 2)


//Соотношение Profit/Risk
RR = math.round (profit / loss , 2)

//Рейтинги анатации
rating1 = "🔥"
rating2 = "👍"
rating3 = "🤓" 
rating4 = "🤡"
rating5 = "⛔"
rating6 = '🙄'
rating7 = "🔴"
rating8 = "🟢"

tool1 = "Отличные ожидания от сделки"
tool2 = "Хорошо смотрится"
tool3 = "Неплохо, но можно и лучше, ботаник - ты"
tool4 = "оно того стоит, подумай еще раз"
tool5 = "ты ничего не попутал, прибыль в другой стороне"
tool6 = "Знакомое чувство...?"

rating =  RR <= 0.8 ? rating5 : RR > 0.8 and RR <= 1.2 ? rating4 : RR > 1.2 and RR <= 2.0 ? rating3 : RR > 2.0 and  RR <= 3.0 ? rating2 : RR > 3.0 ? rating1 : rating6
tools =  RR <= 0.8 ? tool5 : RR > 0.8 and RR <= 1.2 ? tool4 : RR > 1.2 and RR <= 2.0 ? tool3 : RR > 2.0 and  RR <= 3.0 ? tool2 : RR > 3.0 ? tool1 : tool6

//Максимальный объем позиции (в руб. и % от счета) и объем позиции (в лотах)
maxvol = math.round (i_position * (i_riskPercent / loss_perc), 0)
maxvol_perc = math.round ((i_position * (i_riskPercent / loss_perc)) / i_position * 100, 2)
lots = math.round (maxvol / entryPrice, 0 ) 

//Прибыль / убыток в денежном выражении
loss_money = math.round (lots * loss, 0 )
profit_money = math.round (lots * profit, 0)


var tbl_money = table.new(position.bottom_right, 12, 12, border_width = 1, bgcolor = c_posCalcCol3Bg, border_color = c_posCalcCol2Bg)

if barstate.islast and show_calc
    table.cell(tbl_money, 0, 0, "Депозит", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, tooltip = tt_position, text_halign = text.align_left)
    table.cell(tbl_money, 0, 1, '💰 ' + str.tostring(i_position) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, text_size = size.small, tooltip = tt_position, text_halign = text.align_left)
    table.cell(tbl_money, 1, 0, "Риск", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, tooltip = tt_risk)
    table.cell(tbl_money, 1, 1, str.tostring(i_riskPercent) + ' % ' + "( " + str.tostring(risk_amount) + " " + str.tostring(money_symbol) + ")", text_color = c_posCalcColor, text_size = size.small, tooltip = tt_risk)
    table.cell(tbl_money, 2, 0, "Точка входа", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small)
    table.cell(tbl_money, 2, 1, str.tostring(entryPrice) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 0, 2, "Стоп", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 2, str.tostring(i_stopPrice) + str.tostring(Stop), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 2, 2, rating7 + " " + str.tostring(f_amount (sl_val)), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 0, 3, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)
    table.cell(tbl_money, 1, 3, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)
    table.cell(tbl_money, 2, 3, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)
  
    table.cell(tbl_money, 0, 4, "Убыток", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 4, str.tostring(f_amount (loss)) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, bgcolor = c_posCalcCol3Bg , text_size = size.small)
    table.cell(tbl_money, 2, 4, str.tostring(f_amount (loss_perc)) + " %", text_color = c_posCalcColor, bgcolor = c_posCalcCol3Bg, text_size = size.small)
    table.cell(tbl_money, 0, 5, "Прибыль", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 5, str.tostring(f_amount (profit )) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, bgcolor = c_posCalcCol3Bg, text_size = size.small)
    table.cell(tbl_money, 2, 5, str.tostring(f_amount (profit_perc)) + " %", text_color = c_posCalcColor, bgcolor = c_posCalcCol3Bg, text_size = size.small)
    table.cell(tbl_money, 0, 6, "Риск / Профит", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 6, str.tostring(RR), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 2, 6, str.tostring(rating), text_color = c_posCalcColor, text_size = size.small, tooltip = str.tostring(tools))
    table.cell(tbl_money, 0, 7, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)
    table.cell(tbl_money, 1, 7, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)
    table.cell(tbl_money, 2, 7, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 0.2)

    table.cell(tbl_money, 0, 8, "Max объем", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 8, str.tostring(maxvol) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 2, 8, str.tostring(maxvol_perc) + " %", text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 0, 9, "Купить в " + str.tostring (type_trade), text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 9, str.tostring(lots) + " шт", text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 2, 9, rating8 + " " + str.tostring(f_amount (auto_protit)), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 0, 10, "Результат", text_color = c_posCalcColor1, bgcolor = c_posCalcCol1Bg, text_size = size.small, text_halign = text.align_left)
    table.cell(tbl_money, 1, 10, "SL" + " 💰" + str.tostring(loss_money) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 2, 10, "TP" + " 💰" + str.tostring(profit_money) + " " + str.tostring(money_symbol), text_color = c_posCalcColor, text_size = size.small)
    table.cell(tbl_money, 0, 11, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 2)
    table.cell(tbl_money, 1, 11, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 2)
    table.cell(tbl_money, 2, 11, "", bgcolor = c_posCalcCol2Bg, text_size = size.small, height = 2)