对于循环问题,根据公式打印 2 条水平线。
当证券、价格/收盘价发生变化时,必须自动删除旧线路并按照上述公式替换为新线路
//@version=4
study("g", overlay=true)
float g_90 = 0
float g_90_1 = 0
for g_90 = 0 to 1000000 // 1000000 can be any infinite number
g_90_1 = g_90 + 1 // second variable is 1 value above previous variable g_90
g_90_return = 4*(g_90*g_90) + 7*(g_90) + 4 //assign a variable g_90_return; to the formula1 = 4*(g_90*g_90) + 7*(g_90) + 4 to plot a horizontal line
g_90_1_return = 4*(g_90_1*g_90_1) + 7*(g_90_1) + 4 //assign a variable g_90_1_return; to the formula2 = 4*(g_90_1*g_90_1) + 7*(g_90_1) + 4 with second variable to plot another horizontal line
if( (g_90_return < close) and ( g_90_1_return > close) ) // if close > formula1 and close < formula2, draw both the hroizontal lines; as long as price is contained within them
hline(g_90_return , color = color.blue, linewidth= 4)
hline(g_90_1_return , color = color.blue, linewidth= 4)
else
g_90 := g_90 + 1 // run loop again with incremental value