I tried to insert the value of the variable (score 1 to score 1000) in an arrays 2X1000. The first column is the number of bars back and the second column is the value of the score 1 to score 1000 which is based on the bars back. Each proxy is an integer between 1 and 9. I need to make a loop to generate the value of each score in the array I’m not good with loops and it will be really appreciated if someone can show me how to loop those score in that array.
(score1=(proxy1-proxy1[1])*50+ (proxy2-proxy2[1])*50+ (proxy3-proxy3[1])*50+ (proxy4-proxy4[1])*50+ (proxy5-proxy5[1])*25+ (proxy6-proxy6[1])*25+ (proxy7-proxy7[1])*50+ (proxy8-proxy8[1])*50
score2=(proxy1-proxy1[2])*50+(proxy2-proxy2[2])*50+(proxy3-proxy3[2])*50+(proxy4-proxy4[2])*50+(proxy5-proxy5[2])*25+(proxy6-proxy6[2])*25+(proxy7-proxy7[2])*50+(proxy8-proxy8[2])*50
var table scoretable = table.new(position.top_right, 2, 1000, border_width=1)
f_fillCell(_table, _column, _row, _value, _txtcolor) => _value
table.cell(_table, _column, _row, _cellText, bgcolor=_bgcolor, text_color=_txtcolor)
if barstate.islastconfirmedhistory
f_fillCell(scoreTable, 0, 0, 1, color.white)
f_fillCell(scoreTable, 1, 0, 2, color.white)
f_fillCell(scoreTable, 2, 0, 3, color.white)
f_fillCell(scoreTable, 3, 0, 4, color.white)
f_fillCell(scoreTable, 0, 1, score1, color.white)
f_fillCell(scoreTable, 1, 1, score2, color.white)
f_fillCell(scoreTable, 2, 1, score3, color.white)
f_fillCell(scoreTable, 3, 1, score4, color.white)
var table scoreTable = table.new(position.top_right, 2, 1000, border_width=1)
f_fillCell(_table, _column, _row, _value, _txtcolor) =>
_cellText = _value
table.cell(_table, _column, _row, _cellText, text_color=_txtcolor)
if barstate.islastconfirmedhistory
for i= 1 to 1000
j= 0 to 999
f_fillCell(scoreTable, 0, j, i, color.white)
f_fillCell(scoreTable, 1, j, (proxy1-proxy1[i])*50+(proxy2-proxy2[i])*50+(proxy3-proxy3[i])*
50+(proxy4-proxy4[i])* 50+(proxy5-proxy5[i])* 25+(proxy6-proxy6[i])* 25+(proxy7-proxy7[i])
*50+ (proxy8-proxy8[i])*50,)
Joffrey Bousquet is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.