Volume accumulation on past range [TCS] | VTA
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © zendrer

//@version=5
indicator(shorttitle='TCS•VOL ACC FIXED', title='TCS • VOLUME ACCUMULATION FIXED RANGE', precision=0, overlay =true, max_boxes_count = 500)
//••••••••••••••
//INPUT
//••••••••••••••

//----------------------------------------------------------------
//TIME PERIOD
//----------------------------------------------------------------
endPeriodTime = input.time(timestamp('30 Jun 2023'), '', group = 'DATE RANGE', tooltip = "! It calculate from one bar after the dat7time choosed")
x1 = input.int(100, minval = 2, maxval = 100, step = 1, title = "VOLUME BARS LOOK-BACK", group = 'DATE RANGE', tooltip = "min : 2 - max : 100, From the date choosed")
//----------------------------------------------------------------

//••••••••••••••
//FUNCTION
//••••••••••••••
//VOL BUY-SELL
//----------------------------------------------------------------
buyVol = high[1] == low[1] ? 0 : volume[1] * (close[1] - low[1]) / (high[1] - low[1])
sellVol = high[1] == low[1] ? 0 : volume[1] * (high[1] - close[1]) / (high[1] - low[1])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol2 = high[2] == low[2] ? 0 : volume[2] * (close[2] - low[2]) / (high[2] - low[2])
sellVol2 = high[2] == low[2] ? 0 : volume[2] * (high[2] - close[2]) / (high[2] - low[2])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol3 = high[3] == low[3] ? 0 : volume[3] * (close[3] - low[3]) / (high[3] - low[3])
sellVol3 = high[3] == low[3] ? 0 : volume[3] * (high[3] - close[3]) / (high[3] - low[3])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol4 = high[4] == low[4] ? 0 : volume[4] * (close[4] - low[4]) / (high[4] - low[4])
sellVol4 = high[4] == low[4] ? 0 : volume[4] * (high[4] - close[4]) / (high[4] - low[4])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol5 = high[5] == low[5] ? 0 : volume[5] * (close[5] - low[5]) / (high[5] - low[5])
sellVol5 = high[5] == low[5] ? 0 : volume[5] * (high[5] - close[5]) / (high[5] - low[5])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol6 = high[6] == low[6] ? 0 : volume[6] * (close[6] - low[6]) / (high[6] - low[6])
sellVol6 = high[6] == low[6] ? 0 : volume[6] * (high[6] - close[6]) / (high[6] - low[6])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol7 = high[7] == low[7] ? 0 : volume[7] * (close[7] - low[7]) / (high[7] - low[7])
sellVol7 = high[7] == low[7] ? 0 : volume[7] * (high[7] - close[7]) / (high[7] - low[7])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol8 = high[8] == low[8] ? 0 : volume[8] * (close[8] - low[8]) / (high[8] - low[8])
sellVol8 = high[8] == low[8] ? 0 : volume[8] * (high[8] - close[8]) / (high[8] - low[8])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol9 = high[9] == low[9] ? 0 : volume[9] * (close[9] - low[9]) / (high[9] - low[9])
sellVol9 = high[9] == low[9] ? 0 : volume[9] * (high[9] - close[9]) / (high[9] - low[9])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol10 = high[10] == low[10] ? 0 : volume[10] * (close[10] - low[10]) / (high[10] - low[10])
sellVol10 = high[10] == low[10] ? 0 : volume[10] * (high[10] - close[10]) / (high[10] - low[10])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol11 = high[11] == low[11] ? 0 : volume[11] * (close[11] - low[11]) / (high[11] - low[11])
sellVol11 = high[11] == low[11] ? 0 : volume[11] * (high[11] - close[11]) / (high[11] - low[11])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol12 = high[12] == low[12] ? 0 : volume[12] * (close[12] - low[12]) / (high[12] - low[12])
sellVol12 = high[12] == low[12] ? 0 : volume[12] * (high[12] - close[12]) / (high[12] - low[12])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol13 = high[13] == low[13] ? 0 : volume[13] * (close[13] - low[13]) / (high[13] - low[13])
sellVol13 = high[13] == low[13] ? 0 : volume[13] * (high[13] - close[13]) / (high[13] - low[13])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol14 = high[14] == low[14] ? 0 : volume[14] * (close[14] - low[14]) / (high[14] - low[14])
sellVol14 = high[14] == low[14] ? 0 : volume[14] * (high[14] - close[14]) / (high[14] - low[14])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol15 = high[15] == low[15] ? 0 : volume[15] * (close[15] - low[15]) / (high[15] - low[15])
sellVol15 = high[15] == low[15] ? 0 : volume[15] * (high[15] - close[15]) / (high[15] - low[15])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol16 = high[16] == low[16] ? 0 : volume[16] * (close[16] - low[16]) / (high[16] - low[16])
sellVol16 = high[16] == low[16] ? 0 : volume[16] * (high[16] - close[16]) / (high[16] - low[16])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol17 = high[17] == low[17] ? 0 : volume[17] * (close[17] - low[17]) / (high[17] - low[17])
sellVol17 = high[17] == low[17] ? 0 : volume[17] * (high[17] - close[17]) / (high[17] - low[17])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol18 = high[18] == low[18] ? 0 : volume[18] * (close[18] - low[18]) / (high[18] - low[18])
sellVol18 = high[18] == low[18] ? 0 : volume[18] * (high[18] - close[18]) / (high[18] - low[18])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol19 = high[19] == low[19] ? 0 : volume[19] * (close[19] - low[19]) / (high[19] - low[19])
sellVol19 = high[19] == low[19] ? 0 : volume[19] * (high[19] - close[19]) / (high[19] - low[19])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol20 = high[20] == low[20] ? 0 : volume[20] * (close[20] - low[20]) / (high[20] - low[20])
sellVol20 = high[20] == low[20] ? 0 : volume[20] * (high[20] - close[20]) / (high[20] - low[20])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol21 = high[21] == low[21] ? 0 : volume[21] * (close[21] - low[21]) / (high[21] - low[21])
sellVol21 = high[21] == low[21] ? 0 : volume[21] * (high[21] - close[21]) / (high[21] - low[21])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol22 = high[22] == low[22] ? 0 : volume[22] * (close[22] - low[22]) / (high[22] - low[22])
sellVol22 = high[22] == low[22] ? 0 : volume[22] * (high[22] - close[22]) / (high[22] - low[22])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol23 = high[23] == low[23] ? 0 : volume[23] * (close[23] - low[23]) / (high[23] - low[23])
sellVol23 = high[23] == low[23] ? 0 : volume[23] * (high[23] - close[23]) / (high[23] - low[23])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol24 = high[24] == low[24] ? 0 : volume[24] * (close[24] - low[24]) / (high[24] - low[24])
sellVol24 = high[24] == low[24] ? 0 : volume[24] * (high[24] - close[24]) / (high[24] - low[24])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol25 = high[25] == low[25] ? 0 : volume[25] * (close[25] - low[25]) / (high[25] - low[25])
sellVol25 = high[25] == low[25] ? 0 : volume[25] * (high[25] - close[25]) / (high[25] - low[25])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol26 = high[26] == low[26] ? 0 : volume[26] * (close[26] - low[26]) / (high[26] - low[26])
sellVol26 = high[26] == low[26] ? 0 : volume[26] * (high[26] - close[26]) / (high[26] - low[26])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol27 = high[27] == low[27] ? 0 : volume[27] * (close[27] - low[27]) / (high[27] - low[27])
sellVol27 = high[27] == low[27] ? 0 : volume[27] * (high[27] - close[27]) / (high[27] - low[27])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol28 = high[28] == low[28] ? 0 : volume[28] * (close[28] - low[28]) / (high[28] - low[28])
sellVol28 = high[28] == low[28] ? 0 : volume[28] * (high[28] - close[28]) / (high[28] - low[28])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol29 = high[29] == low[29] ? 0 : volume[29] * (close[29] - low[29]) / (high[29] - low[29])
sellVol29 = high[29] == low[29] ? 0 : volume[29] * (high[29] - close[29]) / (high[29] - low[29])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol30 = high[30] == low[30] ? 0 : volume[30] * (close[30] - low[30]) / (high[30] - low[30])
sellVol30 = high[30] == low[30] ? 0 : volume[30] * (high[30] - close[30]) / (high[30] - low[30])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol31 = high[31] == low[31] ? 0 : volume[31] * (close[31] - low[31]) / (high[31] - low[31])
sellVol31 = high[31] == low[31] ? 0 : volume[31] * (high[31] - close[31]) / (high[31] - low[31])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol32 = high[32] == low[32] ? 0 : volume[32] * (close[32] - low[32]) / (high[32] - low[32])
sellVol32 = high[32] == low[32] ? 0 : volume[32] * (high[32] - close[32]) / (high[32] - low[32])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol33 = high[33] == low[33] ? 0 : volume[33] * (close[33] - low[33]) / (high[33] - low[33])
sellVol33 = high[33] == low[33] ? 0 : volume[33] * (high[33] - close[33]) / (high[33] - low[33])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol34 = high[34] == low[34] ? 0 : volume[34] * (close[34] - low[34]) / (high[34] - low[34])
sellVol34 = high[34] == low[34] ? 0 : volume[34] * (high[34] - close[34]) / (high[34] - low[34])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol35 = high[35] == low[35] ? 0 : volume[35] * (close[35] - low[35]) / (high[35] - low[35])
sellVol35 = high[35] == low[35] ? 0 : volume[35] * (high[35] - close[35]) / (high[35] - low[35])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol36 = high[36] == low[36] ? 0 : volume[36] * (close[36] - low[36]) / (high[36] - low[36])
sellVol36 = high[36] == low[36] ? 0 : volume[36] * (high[36] - close[36]) / (high[36] - low[36])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol37 = high[37] == low[37] ? 0 : volume[37] * (close[37] - low[37]) / (high[37] - low[37])
sellVol37 = high[37] == low[37] ? 0 : volume[37] * (high[37] - close[37]) / (high[37] - low[37])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol38 = high[38] == low[38] ? 0 : volume[38] * (close[38] - low[38]) / (high[38] - low[38])
sellVol38 = high[38] == low[38] ? 0 : volume[38] * (high[38] - close[38]) / (high[38] - low[38])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol39 = high[39] == low[39] ? 0 : volume[39] * (close[39] - low[39]) / (high[39] - low[39])
sellVol39 = high[39] == low[39] ? 0 : volume[39] * (high[39] - close[39]) / (high[39] - low[39])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol40 = high[40] == low[40] ? 0 : volume[40] * (close[40] - low[40]) / (high[40] - low[40])
sellVol40 = high[40] == low[40] ? 0 : volume[40] * (high[40] - close[40]) / (high[40] - low[40])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol41 = high[41] == low[41] ? 0 : volume[41] * (close[41] - low[41]) / (high[41] - low[41])
sellVol41 = high[41] == low[41] ? 0 : volume[41] * (high[41] - close[41]) / (high[41] - low[41])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol42 = high[42] == low[42] ? 0 : volume[42] * (close[42] - low[42]) / (high[42] - low[42])
sellVol42 = high[42] == low[42] ? 0 : volume[42] * (high[42] - close[42]) / (high[42] - low[42])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol43 = high[43] == low[43] ? 0 : volume[43] * (close[43] - low[43]) / (high[43] - low[43])
sellVol43 = high[43] == low[43] ? 0 : volume[43] * (high[43] - close[43]) / (high[43] - low[43])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol44 = high[44] == low[44] ? 0 : volume[44] * (close[44] - low[44]) / (high[44] - low[44])
sellVol44 = high[44] == low[44] ? 0 : volume[44] * (high[44] - close[44]) / (high[44] - low[44])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol45 = high[45] == low[45] ? 0 : volume[45] * (close[45] - low[45]) / (high[45] - low[45])
sellVol45 = high[45] == low[45] ? 0 : volume[45] * (high[45] - close[45]) / (high[45] - low[45])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol46 = high[46] == low[46] ? 0 : volume[46] * (close[46] - low[46]) / (high[46] - low[46])
sellVol46 = high[46] == low[46] ? 0 : volume[46] * (high[46] - close[46]) / (high[46] - low[46])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol47 = high[47] == low[47] ? 0 : volume[47] * (close[47] - low[47]) / (high[47] - low[47])
sellVol47 = high[47] == low[47] ? 0 : volume[47] * (high[47] - close[47]) / (high[47] - low[47])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol48 = high[48] == low[48] ? 0 : volume[48] * (close[48] - low[48]) / (high[48] - low[48])
sellVol48 = high[48] == low[48] ? 0 : volume[48] * (high[48] - close[48]) / (high[48] - low[48])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol49 = high[49] == low[49] ? 0 : volume[49] * (close[49] - low[49]) / (high[49] - low[49])
sellVol49 = high[49] == low[49] ? 0 : volume[49] * (high[49] - close[49]) / (high[49] - low[49])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol50 = high[50] == low[50] ? 0 : volume[50] * (close[50] - low[50]) / (high[50] - low[50])
sellVol50 = high[50] == low[50] ? 0 : volume[50] * (high[50] - close[50]) / (high[50] - low[50])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol51 = high[51] == low[51] ? 0 : volume[51] * (close[51] - low[51]) / (high[51] - low[51])
sellVol51 = high[51] == low[51] ? 0 : volume[51] * (high[51] - close[51]) / (high[51] - low[51])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol52 = high[52] == low[52] ? 0 : volume[52] * (close[52] - low[52]) / (high[52] - low[52])
sellVol52 = high[52] == low[52] ? 0 : volume[52] * (high[52] - close[52]) / (high[52] - low[52])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol53 = high[53] == low[53] ? 0 : volume[53] * (close[53] - low[53]) / (high[53] - low[53])
sellVol53 = high[53] == low[53] ? 0 : volume[53] * (high[53] - close[53]) / (high[53] - low[53])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol54 = high[54] == low[54] ? 0 : volume[54] * (close[54] - low[54]) / (high[54] - low[54])
sellVol54 = high[54] == low[54] ? 0 : volume[54] * (high[54] - close[54]) / (high[54] - low[54])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol55 = high[55] == low[55] ? 0 : volume[55] * (close[55] - low[55]) / (high[55] - low[55])
sellVol55 = high[55] == low[55] ? 0 : volume[55] * (high[55] - close[55]) / (high[55] - low[55])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol56 = high[56] == low[56] ? 0 : volume[56] * (close[56] - low[56]) / (high[56] - low[56])
sellVol56 = high[56] == low[56] ? 0 : volume[56] * (high[56] - close[56]) / (high[56] - low[56])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol57 = high[57] == low[57] ? 0 : volume[57] * (close[57] - low[57]) / (high[57] - low[57])
sellVol57 = high[57] == low[57] ? 0 : volume[57] * (high[57] - close[57]) / (high[57] - low[57])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol58 = high[58] == low[58] ? 0 : volume[58] * (close[58] - low[58]) / (high[58] - low[58])
sellVol58 = high[58] == low[58] ? 0 : volume[58] * (high[58] - close[58]) / (high[58] - low[58])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol59 = high[59] == low[59] ? 0 : volume[59] * (close[59] - low[59]) / (high[59] - low[59])
sellVol59 = high[59] == low[59] ? 0 : volume[59] * (high[59] - close[59]) / (high[59] - low[59])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol60 = high[60] == low[60] ? 0 : volume[60] * (close[60] - low[60]) / (high[60] - low[60])
sellVol60 = high[60] == low[60] ? 0 : volume[60] * (high[60] - close[60]) / (high[60] - low[60])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol61 = high[61] == low[61] ? 0 : volume[61] * (close[61] - low[61]) / (high[61] - low[61])
sellVol61 = high[61] == low[61] ? 0 : volume[61] * (high[61] - close[61]) / (high[61] - low[61])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol62 = high[62] == low[62] ? 0 : volume[62] * (close[62] - low[62]) / (high[62] - low[62])
sellVol62 = high[62] == low[62] ? 0 : volume[62] * (high[62] - close[62]) / (high[62] - low[62])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol63 = high[63] == low[63] ? 0 : volume[63] * (close[63] - low[63]) / (high[63] - low[63])
sellVol63 = high[63] == low[63] ? 0 : volume[63] * (high[63] - close[63]) / (high[63] - low[63])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol64 = high[64] == low[64] ? 0 : volume[64] * (close[64] - low[64]) / (high[64] - low[64])
sellVol64 = high[64] == low[64] ? 0 : volume[64] * (high[64] - close[64]) / (high[64] - low[64])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol65 = high[65] == low[65] ? 0 : volume[65] * (close[65] - low[65]) / (high[65] - low[65])
sellVol65 = high[65] == low[65] ? 0 : volume[65] * (high[65] - close[65]) / (high[65] - low[65])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol66 = high[66] == low[66] ? 0 : volume[66] * (close[66] - low[66]) / (high[66] - low[66])
sellVol66 = high[66] == low[66] ? 0 : volume[66] * (high[66] - close[66]) / (high[66] - low[66])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol67 = high[67] == low[67] ? 0 : volume[67] * (close[67] - low[67]) / (high[67] - low[67])
sellVol67 = high[67] == low[67] ? 0 : volume[67] * (high[67] - close[67]) / (high[67] - low[67])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol68 = high[68] == low[68] ? 0 : volume[68] * (close[68] - low[68]) / (high[68] - low[68])
sellVol68 = high[68] == low[68] ? 0 : volume[68] * (high[68] - close[68]) / (high[68] - low[68])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol69 = high[69] == low[69] ? 0 : volume[69] * (close[69] - low[69]) / (high[69] - low[69])
sellVol69 = high[69] == low[69] ? 0 : volume[69] * (high[69] - close[69]) / (high[69] - low[69])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol70 = high[70] == low[70] ? 0 : volume[70] * (close[70] - low[70]) / (high[70] - low[70])
sellVol70 = high[70] == low[70] ? 0 : volume[70] * (high[70] - close[70]) / (high[70] - low[70])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol71 = high[71] == low[71] ? 0 : volume[71] * (close[71] - low[71]) / (high[71] - low[71])
sellVol71 = high[71] == low[71] ? 0 : volume[71] * (high[71] - close[71]) / (high[71] - low[71])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol72 = high[72] == low[72] ? 0 : volume[72] * (close[72] - low[72]) / (high[72] - low[72])
sellVol72 = high[72] == low[72] ? 0 : volume[72] * (high[72] - close[72]) / (high[72] - low[72])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol73 = high[73] == low[73] ? 0 : volume[73] * (close[73] - low[73]) / (high[73] - low[73])
sellVol73 = high[73] == low[73] ? 0 : volume[73] * (high[73] - close[73]) / (high[73] - low[73])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol74 = high[74] == low[74] ? 0 : volume[74] * (close[74] - low[74]) / (high[74] - low[74])
sellVol74 = high[74] == low[74] ? 0 : volume[74] * (high[74] - close[74]) / (high[74] - low[74])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol75 = high[75] == low[75] ? 0 : volume[75] * (close[75] - low[75]) / (high[75] - low[75])
sellVol75 = high[75] == low[75] ? 0 : volume[75] * (high[75] - close[75]) / (high[75] - low[75])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol76 = high[76] == low[76] ? 0 : volume[76] * (close[76] - low[76]) / (high[76] - low[76])
sellVol76 = high[76] == low[76] ? 0 : volume[76] * (high[76] - close[76]) / (high[76] - low[76])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol77 = high[77] == low[77] ? 0 : volume[77] * (close[77] - low[77]) / (high[77] - low[77])
sellVol77 = high[77] == low[77] ? 0 : volume[77] * (high[77] - close[77]) / (high[77] - low[77])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol78 = high[78] == low[78] ? 0 : volume[78] * (close[78] - low[78]) / (high[78] - low[78])
sellVol78 = high[78] == low[78] ? 0 : volume[78] * (high[78] - close[78]) / (high[78] - low[78])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol79 = high[79] == low[79] ? 0 : volume[79] * (close[79] - low[79]) / (high[79] - low[79])
sellVol79 = high[79] == low[79] ? 0 : volume[79] * (high[79] - close[79]) / (high[79] - low[79])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol80 = high[80] == low[80] ? 0 : volume[80] * (close[80] - low[80]) / (high[80] - low[80])
sellVol80 = high[80] == low[80] ? 0 : volume[80] * (high[80] - close[80]) / (high[80] - low[80])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol81 = high[81] == low[81] ? 0 : volume[81] * (close[81] - low[81]) / (high[81] - low[81])
sellVol81 = high[81] == low[81] ? 0 : volume[81] * (high[81] - close[81]) / (high[81] - low[81])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol82 = high[82] == low[82] ? 0 : volume[82] * (close[82] - low[82]) / (high[82] - low[82])
sellVol82 = high[82] == low[82] ? 0 : volume[82] * (high[82] - close[82]) / (high[82] - low[82])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol83 = high[83] == low[83] ? 0 : volume[83] * (close[83] - low[83]) / (high[83] - low[83])
sellVol83 = high[83] == low[83] ? 0 : volume[83] * (high[83] - close[83]) / (high[83] - low[83])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol84 = high[84] == low[84] ? 0 : volume[84] * (close[84] - low[84]) / (high[84] - low[84])
sellVol84 = high[84] == low[84] ? 0 : volume[84] * (high[84] - close[84]) / (high[84] - low[84])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol85 = high[85] == low[85] ? 0 : volume[85] * (close[85] - low[85]) / (high[85] - low[85])
sellVol85 = high[85] == low[85] ? 0 : volume[85] * (high[85] - close[85]) / (high[85] - low[85])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol86 = high[86] == low[86] ? 0 : volume[86] * (close[86] - low[86]) / (high[86] - low[86])
sellVol86 = high[86] == low[86] ? 0 : volume[86] * (high[86] - close[86]) / (high[86] - low[86])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol87 = high[87] == low[87] ? 0 : volume[87] * (close[87] - low[87]) / (high[87] - low[87])
sellVol87 = high[87] == low[87] ? 0 : volume[87] * (high[87] - close[87]) / (high[87] - low[87])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol88 = high[88] == low[88] ? 0 : volume[88] * (close[88] - low[88]) / (high[88] - low[88])
sellVol88 = high[88] == low[88] ? 0 : volume[88] * (high[88] - close[88]) / (high[88] - low[88])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol89 = high[89] == low[89] ? 0 : volume[89] * (close[89] - low[89]) / (high[89] - low[89])
sellVol89 = high[89] == low[89] ? 0 : volume[89] * (high[89] - close[89]) / (high[89] - low[89])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol90 = high[90] == low[90] ? 0 : volume[90] * (close[90] - low[90]) / (high[90] - low[90])
sellVol90 = high[90] == low[90] ? 0 : volume[90] * (high[90] - close[90]) / (high[90] - low[90])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol91 = high[91] == low[91] ? 0 : volume[91] * (close[91] - low[91]) / (high[91] - low[91])
sellVol91 = high[91] == low[91] ? 0 : volume[91] * (high[91] - close[91]) / (high[91] - low[91])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol92 = high[92] == low[92] ? 0 : volume[92] * (close[92] - low[92]) / (high[92] - low[92])
sellVol92 = high[92] == low[92] ? 0 : volume[92] * (high[92] - close[92]) / (high[92] - low[92])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol93 = high[93] == low[93] ? 0 : volume[93] * (close[93] - low[93]) / (high[93] - low[93])
sellVol93 = high[93] == low[93] ? 0 : volume[93] * (high[93] - close[93]) / (high[93] - low[93])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol94 = high[94] == low[94] ? 0 : volume[94] * (close[94] - low[94]) / (high[94] - low[94])
sellVol94 = high[94] == low[94] ? 0 : volume[94] * (high[94] - close[94]) / (high[94] - low[94])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol95 = high[95] == low[95] ? 0 : volume[95] * (close[95] - low[95]) / (high[95] - low[95])
sellVol95 = high[95] == low[95] ? 0 : volume[95] * (high[95] - close[95]) / (high[95] - low[95])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol96 = high[96] == low[96] ? 0 : volume[96] * (close[96] - low[96]) / (high[96] - low[96])
sellVol96 = high[96] == low[96] ? 0 : volume[96] * (high[96] - close[96]) / (high[96] - low[96])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol97 = high[97] == low[97] ? 0 : volume[97] * (close[97] - low[97]) / (high[97] - low[97])
sellVol97 = high[97] == low[97] ? 0 : volume[97] * (high[97] - close[97]) / (high[97] - low[97])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol98 = high[98] == low[98] ? 0 : volume[98] * (close[98] - low[98]) / (high[98] - low[98])
sellVol98 = high[98] == low[98] ? 0 : volume[98] * (high[98] - close[98]) / (high[98] - low[98])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol99 = high[99] == low[99] ? 0 : volume[99] * (close[99] - low[99]) / (high[99] - low[99])
sellVol99 = high[99] == low[99] ? 0 : volume[99] * (high[99] - close[99]) / (high[99] - low[99])
//----------------------------------------------------------------
//----------------------------------------------------------------
buyVol100 = high[100] == low[100] ? 0 : volume[100] * (close[100] - low[100]) / (high[100] - low[100])
sellVol100 = high[100] == low[100] ? 0 : volume[100] * (high[100] - close[100]) / (high[100] - low[100])
//----------------------------------------------------------------


//VOLUME LOOKBACK
//----------------------------------------------------------------
vol1 = buyVol
volm1 = sellVol
vol2 = vol1 + buyVol2
volm2 = volm1 + sellVol2
vol3 = vol2 + buyVol3
volm3 = volm2 + sellVol3
vol4 = vol3 + buyVol4
volm4 = volm3 + sellVol4
vol5 = vol4 + buyVol5
volm5 = volm4 + sellVol5
vol6 = vol5 + buyVol6
volm6 = volm5 + sellVol6
vol7 = vol6  + buyVol7
volm7 = volm6 + sellVol7
vol8 = vol7 + buyVol8
volm8 = volm7 + sellVol8
vol9 = vol8 + buyVol9
volm9 = volm8 + sellVol9
vol10 = vol9 + buyVol10
volm10 = volm9 + sellVol10
vol11 = vol10 + buyVol11
volm11 = volm10 + sellVol11
vol12 = vol11+ buyVol12
volm12 = volm11 + sellVol12
vol13 = vol12+ buyVol13
volm13 = volm12 + sellVol13
vol14 = vol13 + buyVol14
volm14 = volm13 + sellVol14
vol15 = vol14 + buyVol15
volm15 = volm14 + sellVol15
vol16 = vol15 + buyVol16
volm16 = volm15 + sellVol16
vol17 = vol16 + buyVol17
volm17 = volm16 + sellVol17
vol18 = vol17 + buyVol18
volm18 = volm17 + sellVol18
vol19 = vol18 + buyVol19
volm19 = volm18 + sellVol19
vol20 = vol19 + buyVol20
volm20 = volm19 + sellVol20
vol21 = vol20 + buyVol21
volm21 = volm20 + sellVol21
vol22 = vol21 + buyVol22
volm22 = volm21 + sellVol22
vol23 = vol22 + buyVol23
volm23 = volm22 + sellVol23
vol24 = vol23 + buyVol24
volm24 = volm23 + sellVol24
vol25 = vol24 + buyVol25
volm25 = volm24 + sellVol25
vol26 = vol25 + buyVol26
volm26 = volm25 + sellVol26
vol27 = vol26 + buyVol27
volm27 = volm26 + sellVol27
vol28 = vol27 + buyVol28
volm28 = volm27 + sellVol28
vol29 = vol28 + buyVol29
volm29 = volm28 + sellVol29
vol30 = vol29 + buyVol30
volm30 = volm29 + sellVol30
vol31 = vol30 + buyVol31
volm31 = volm30 + sellVol31
vol32 = vol31 + buyVol32
volm32 = volm31 + sellVol32
vol33 = vol32 + buyVol33
volm33 = volm32 + sellVol33
vol34 = vol33 + buyVol34
volm34 = volm33 + sellVol34
vol35 = vol34 + buyVol35
volm35 = volm34 + sellVol35
vol36 = vol35  + buyVol36
volm36 = volm35 + sellVol36
vol37 = vol36 + buyVol37
volm37 = volm36 + sellVol37
vol38 = vol37 + buyVol38
volm38 = volm37 + sellVol38
vol39 = vol38 + buyVol39
volm39 = volm38 + sellVol39
vol40 = vol39 + buyVol40
volm40 = volm39 + sellVol40
vol41 = vol40+ buyVol41
volm41 = volm40 + sellVol41
vol42 = vol41 + buyVol42
volm42 = volm41 + sellVol42
vol43 = vol42 + buyVol43
volm43 = volm42 + sellVol43
vol44 = vol43 + buyVol44
volm44 = volm43 + sellVol44
vol45 = vol44 + buyVol45
volm45 = volm44 + sellVol45
vol46 = vol45 + buyVol46
volm46 = volm45 + sellVol46
vol47 = vol46 + buyVol47
volm47 = volm46 + sellVol47
vol48 = vol47 + buyVol48
volm48 = volm47 + sellVol48
vol49 = vol48 + buyVol49
volm49 = volm48 + sellVol49
vol50 = vol49 + buyVol50
volm50 = volm49 + sellVol50
vol51 = vol50 + buyVol51
volm51 = volm50 + sellVol51
vol52 = vol51 + buyVol52
volm52 = volm51 + sellVol52
vol53 = vol52 + buyVol53
volm53 = volm52 + sellVol53
vol54 = vol53 + buyVol54
volm54 = volm53 + sellVol54
vol55 = vol54 + buyVol55
volm55 = volm54 + sellVol55
vol56 = vol55 + buyVol56
volm56 = volm55 + sellVol56
vol57 = vol56 + buyVol57
volm57 = volm56 + sellVol57
vol58 = vol57 + buyVol58
volm58 = volm57 + sellVol58
vol59 = vol58 + buyVol59
volm59 = volm58 + sellVol59
vol60 = vol59 + buyVol60
volm60 = volm59 + sellVol60
vol61 = vol60 + buyVol61
volm61 = volm60 + sellVol61
vol62 = vol61 + buyVol62
volm62 = volm61 + sellVol62
vol63 = vol62 + buyVol63
volm63 = volm62 + sellVol63
vol64 = vol63 + buyVol64
volm64 = volm63 + sellVol64
vol65 = vol64 + buyVol65
volm65 = volm64 + sellVol65
vol66 = vol65 + buyVol66
volm66 = volm65 + sellVol66
vol67 = vol66 + buyVol67
volm67 = volm66 + sellVol67
vol68 = vol67 + buyVol68
volm68 = volm67 + sellVol68
vol69 = vol68 + buyVol69
volm69 = volm68 + sellVol69
vol70 = vol69 + buyVol70
volm70 = volm69 + sellVol70
vol71 = vol70 + buyVol71
volm71 = volm70 + sellVol71
vol72 = vol71 + buyVol72
volm72 = volm71 + sellVol72
vol73 = vol72 + buyVol73
volm73 = volm72 + sellVol73
vol74 = vol73 + buyVol74
volm74 = volm73 + sellVol74
vol75 = vol74 + buyVol75
volm75 = volm74 + sellVol75
vol76 = vol75 + buyVol76
volm76 = volm75 + sellVol76
vol77 = vol76 + buyVol77
volm77 = volm76 + sellVol77
vol78 = vol77 + buyVol78
volm78 = volm77 + sellVol78
vol79 = vol78 + buyVol79
volm79 = volm78 + sellVol79
vol80 = vol79 + buyVol80
volm80 = volm79 + sellVol80
vol81 = vol80 + buyVol81
volm81 = volm80 + sellVol81
vol82 = vol81 + buyVol82
volm82 = volm81 + sellVol82
vol83 = vol82 + buyVol83
volm83 = volm82 + sellVol83
vol84 = vol83 + buyVol84
volm84 = volm83 + sellVol84
vol85 = vol84 + buyVol85
volm85 = volm84 + sellVol85
vol86 = vol85 + buyVol86
volm86 = volm85 + sellVol86
vol87 = vol86 + buyVol87
volm87 = volm86 + sellVol87
vol88 = vol87 + buyVol88
volm88 = volm87 + sellVol88
vol89 = vol88 + buyVol89
volm89 = volm88 + sellVol89
vol90 = vol89 + buyVol90
volm90 = volm89 + sellVol90
vol91 = vol90 + buyVol91
volm91 = volm90 + sellVol91
vol92 = vol91 + buyVol92
volm92 = volm91 + sellVol92
vol93 = vol92 + buyVol93
volm93 = volm92 + sellVol93
vol94 = vol93 + buyVol94
volm94 = volm93 + sellVol94
vol95 = vol94 + buyVol95
volm95 = volm94 + sellVol95
vol96 = vol95 + buyVol96
volm96 = volm95 + sellVol96
vol97 = vol96 + buyVol97
volm97 = volm96 + sellVol97
vol98 = vol97 + buyVol98
volm98 = volm97 + sellVol98
vol99 = vol98 + buyVol99
volm99 = volm98 + sellVol99
vol100 = vol99 + buyVol100
volm100 = volm99 + sellVol100
//----------------------------------------------------------------

//VOLUME DEFINTION
//----------------------------------------------------------------
voldefbull = (x1 == 1) ? vol1 : 
     (x1 == 2) ? vol2 : 
     (x1 == 3) ? vol3 : 
     (x1 == 4) ? vol4 : 
     (x1 == 5) ? vol5 : 
     (x1 == 6) ? vol6 : 
     (x1 == 7) ? vol7 : 
     (x1 == 8) ? vol8 : 
     (x1 == 9) ? vol9 : 
     (x1 == 10) ? vol10 : 
     (x1 == 11) ? vol11 : 
     (x1 == 12) ? vol12 : 
     (x1 == 13) ? vol13 : 
     (x1 == 14) ? vol14 : 
     (x1 == 15) ? vol15 : 
     (x1 == 16) ? vol16 : 
     (x1 == 17) ? vol17 : 
     (x1 == 18) ? vol18 : 
     (x1 == 19) ? vol19 : 
     (x1 == 20) ? vol20 : 
     (x1 == 21) ? vol21 : 
     (x1 == 22) ? vol22 : 
     (x1 == 23) ? vol23 : 
     (x1 == 24) ? vol24 : 
     (x1 == 25) ? vol25 : 
     (x1 == 26) ? vol26 : 
     (x1 == 27) ? vol27 : 
     (x1 == 28) ? vol28 : 
     (x1 == 29) ? vol29 : 
     (x1 == 30) ? vol30 : 
     (x1 == 31) ? vol31 : 
     (x1 == 32) ? vol32 : 
     (x1 == 33) ? vol33 : 
     (x1 == 34) ? vol34 : 
     (x1 == 35) ? vol35 : 
     (x1 == 36) ? vol36 : 
     (x1 == 37) ? vol37 : 
     (x1 == 38) ? vol38 : 
     (x1 == 39) ? vol39 : 
     (x1 == 40) ? vol40 : 
     (x1 == 41) ? vol41 : 
     (x1 == 42) ? vol42 : 
     (x1 == 43) ? vol43 : 
     (x1 == 44) ? vol44 : 
     (x1 == 45) ? vol45 : 
     (x1 == 46) ? vol46 : 
     (x1 == 47) ? vol47 : 
     (x1 == 48) ? vol48 : 
     (x1 == 49) ? vol49 : 
     (x1 == 50) ? vol50 : 
     (x1 == 51) ? vol51 : 
     (x1 == 52) ? vol52 : 
     (x1 == 53) ? vol53 : 
     (x1 == 54) ? vol54 : 
     (x1 == 55) ? vol55 : 
     (x1 == 56) ? vol56 : 
     (x1 == 57) ? vol57 : 
     (x1 == 58) ? vol58 : 
     (x1 == 59) ? vol59 : 
     (x1 == 60) ? vol60 : 
     (x1 == 61) ? vol61 : 
     (x1 == 62) ? vol62 : 
     (x1 == 63) ? vol63 : 
     (x1 == 64) ? vol64 : 
     (x1 == 65) ? vol65 : 
     (x1 == 66) ? vol66 : 
     (x1 == 67) ? vol67 : 
     (x1 == 68) ? vol68 : 
     (x1 == 69) ? vol69 : 
     (x1 == 70) ? vol70 : 
     (x1 == 71) ? vol71 : 
     (x1 == 72) ? vol72 : 
     (x1 == 73) ? vol73 : 
     (x1 == 74) ? vol74 : 
     (x1 == 75) ? vol75 : 
     (x1 == 76) ? vol76 : 
     (x1 == 77) ? vol77 : 
     (x1 == 78) ? vol78 : 
     (x1 == 79) ? vol79 : 
     (x1 == 80) ? vol80 : 
     (x1 == 81) ? vol81 : 
     (x1 == 82) ? vol82 : 
     (x1 == 83) ? vol83 : 
     (x1 == 84) ? vol84 : 
     (x1 == 85) ? vol85 : 
     (x1 == 86) ? vol86 : 
     (x1 == 87) ? vol87 : 
     (x1 == 88) ? vol88 : 
     (x1 == 89) ? vol89 : 
     (x1 == 90) ? vol90 : 
     (x1 == 91) ? vol91 : 
     (x1 == 92) ? vol92 : 
     (x1 == 93) ? vol93 : 
     (x1 == 94) ? vol94 : 
     (x1 == 95) ? vol95 : 
     (x1 == 96) ? vol96 : 
     (x1 == 97) ? vol97 : 
     (x1 == 98) ? vol98 : 
     (x1 == 99) ? vol99 : 
     (x1 == 100) ? vol100 : na

voldefbear = (x1 == 1) ? volm1 : 
     (x1 == 2) ? volm2 : 
     (x1 == 3) ? volm3 : 
     (x1 == 4) ? volm4 : 
     (x1 == 5) ? volm5 : 
     (x1 == 6) ? volm6 : 
     (x1 == 7) ? volm7 : 
     (x1 == 8) ? volm8 : 
     (x1 == 9) ? volm9 : 
     (x1 == 10) ? volm10 : 
     (x1 == 11) ? volm11 : 
     (x1 == 12) ? volm12 : 
     (x1 == 13) ? volm13 : 
     (x1 == 14) ? volm14 : 
     (x1 == 15) ? volm15 : 
     (x1 == 16) ? volm16 : 
     (x1 == 17) ? volm17 : 
     (x1 == 18) ? volm18 : 
     (x1 == 19) ? volm19 : 
     (x1 == 20) ? volm20 : 
     (x1 == 21) ? volm21 : 
     (x1 == 22) ? volm22 : 
     (x1 == 23) ? volm23 : 
     (x1 == 24) ? volm24 : 
     (x1 == 25) ? volm25 : 
     (x1 == 26) ? volm26 : 
     (x1 == 27) ? volm27 : 
     (x1 == 28) ? volm28 : 
     (x1 == 29) ? volm29 : 
     (x1 == 30) ? volm30 : 
     (x1 == 31) ? volm31 : 
     (x1 == 32) ? volm32 : 
     (x1 == 33) ? volm33 : 
     (x1 == 34) ? volm34 : 
     (x1 == 35) ? volm35 : 
     (x1 == 36) ? volm36 : 
     (x1 == 37) ? volm37 : 
     (x1 == 38) ? volm38 : 
     (x1 == 39) ? volm39 : 
     (x1 == 40) ? volm40 : 
     (x1 == 41) ? volm41 : 
     (x1 == 42) ? volm42 : 
     (x1 == 43) ? volm43 : 
     (x1 == 44) ? volm44 : 
     (x1 == 45) ? volm45 : 
     (x1 == 46) ? volm46 : 
     (x1 == 47) ? volm47 : 
     (x1 == 48) ? volm48 : 
     (x1 == 49) ? volm49 : 
     (x1 == 50) ? volm50 : 
     (x1 == 51) ? volm51 : 
     (x1 == 52) ? volm52 : 
     (x1 == 53) ? volm53 : 
     (x1 == 54) ? volm54 : 
     (x1 == 55) ? volm55 : 
     (x1 == 56) ? volm56 : 
     (x1 == 57) ? volm57 : 
     (x1 == 58) ? volm58 : 
     (x1 == 59) ? volm59 : 
     (x1 == 60) ? volm60 : 
     (x1 == 61) ? volm61 : 
     (x1 == 62) ? volm62 : 
     (x1 == 63) ? volm63 : 
     (x1 == 64) ? volm64 : 
     (x1 == 65) ? volm65 : 
     (x1 == 66) ? volm66 : 
     (x1 == 67) ? volm67 : 
     (x1 == 68) ? volm68 : 
     (x1 == 69) ? volm69 : 
     (x1 == 70) ? volm70 : 
     (x1 == 71) ? volm71 : 
     (x1 == 72) ? volm72 : 
     (x1 == 73) ? volm73 : 
     (x1 == 74) ? volm74 : 
     (x1 == 75) ? volm75 : 
     (x1 == 76) ? volm76 : 
     (x1 == 77) ? volm77 : 
     (x1 == 78) ? volm78 : 
     (x1 == 79) ? volm79 : 
     (x1 == 80) ? volm80 : 
     (x1 == 81) ? volm81 : 
     (x1 == 82) ? volm82 : 
     (x1 == 83) ? volm83 : 
     (x1 == 84) ? volm84 : 
     (x1 == 85) ? volm85 : 
     (x1 == 86) ? volm86 : 
     (x1 == 87) ? volm87 : 
     (x1 == 88) ? volm88 : 
     (x1 == 89) ? volm89 : 
     (x1 == 90) ? volm90 : 
     (x1 == 91) ? volm91 : 
     (x1 == 92) ? volm92 : 
     (x1 == 93) ? volm93 : 
     (x1 == 94) ? volm94 : 
     (x1 == 95) ? volm95 : 
     (x1 == 96) ? volm96 : 
     (x1 == 97) ? volm97 : 
     (x1 == 98) ? volm98 : 
     (x1 == 99) ? volm99 : 
     (x1 == 100) ? volm100 : na

//••••••••••••••
//PLOT
//••••••••••••••
//VOLUME ON BACK RANGE
//----------------------------------------------------------------
//SWAP FROM TIME TO BAR INDEX
barindex = (time - endPeriodTime ) / (1000 * timeframe.in_seconds(timeframe.period))
//DEFINE LAST BAR
end = bar_index - barindex

//VARIABLES
var sessionHighPrice = 0.0
var sessionLowPrice  = 0.0
var sessionOpenPrice = 0.0
var ylbale = 0.0
var box sessionBox = na
var label sessionLabel = na

// SESSION DEFINITION
start = end-(bar_index - bar_index[x1])
session = end > bar_index and bar_index > start
sessioncount = end[1] < bar_index 
count = sessioncount and not sessioncount[1]

// SESSION HIGHEST/LOWEST
if session
    sessionHighPrice := high
    sessionLowPrice  := low

    sessionHighPrice := math.max(sessionHighPrice, high)
    sessionLowPrice  := math.min(sessionLowPrice, low)
    //LABEL POSTION
    ylbale := ta.highest(high, x1)

// BOXES AND LABELS
if session
    sessionBox := box.new(left=start+1, top=na, right=na, bottom=na, xloc = xloc.bar_index, border_width=0, bgcolor = color.new(color.lime,98)) 
    box.set_top(sessionBox, sessionHighPrice)
    box.set_bottom(sessionBox, sessionLowPrice)
    box.set_right(sessionBox,end+1)

if count
    sessionLabel := label.new(end, ylbale + 5, text = "BULLISH VOLUME | " + str.tostring((voldefbull),'#.##') + " | " + str.tostring(((voldefbull)*100/(voldefbull+voldefbear)),'#.##') + "%" +  "\n BEARISH VOLUME | " + str.tostring((voldefbear),'#.##') + " | " + str.tostring(((voldefbear)*100/(voldefbull+voldefbear)),'#.##') + "%" + "\n BAR COUNT | " + str.tostring((x1),'#.##'), color = na, style = label.style_label_right, textcolor = color.white )
//----------------------------------------------------------------
//END
