This Pine code gives us strange results, for example, it gives us t = 0, Result = 6552, and close = 6593 There is so much difference between Results(6552) and close(6593), Plz helps me what's wrong in this program, Secondly if ( t = close - Results ) give us 0 which is correct because we move Results = close than minus each other, but the output is showing different. Like ..
Results = 6552
close = 6593
t = (Results - close) which gives us 0 (which is correct)
We need Results and close the same outputs.
//@version=5
indicator("Example code", overlay=true)
varip bool flag = true
var Result = 0.0
var t = 0.0
if flag
Result := close
t := (close - Result)
flag := false
else
na
plotshape(series=t, color=color.yellow, title='t')
plotshape(series=Result, color=color.red, title='Result')
plot(series=close, color=color.lime, title='close')
We need same output of close and Result because we want store data into Result for single time than we flag false to stop enter again in if statement
New contributor
BALJIT SINGH CHAHAL is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.