Strange PineScript Issue
Posted: Thu Jun 24, 2021 2:01 pm
Team,
I wrote this very simple code which basically checks if close is less than open, if is then i just add a label. I added arrays to debug the values, so you may ignore.
However, "checkEntryCondition()" function is not working as expected. Although, close & open values are reported correctly. Can somebody extend their help.
Appreciate your inputs.
I wrote this very simple code which basically checks if close is less than open, if is then i just add a label. I added arrays to debug the values, so you may ignore.
However, "checkEntryCondition()" function is not working as expected. Although, close & open values are reported correctly. Can somebody extend their help.
Appreciate your inputs.
Code: Select all
//@version=4
study("Test", overlay=true)
valsOpen = array.new_float(1, 0)
valsClose = array.new_float(1, 0)
// Function to validate if a candle meets the given criteria
checkEntryCondition() =>
array.insert(valsOpen, 0, open)
array.insert(valsClose, 0, close)
close < open
scr_label = 'Screener: \n##########\n'
//long
s5 = security("AIAENG", "75", checkEntryCondition())
scr_label := s5 ? scr_label + "AIAENG" + '\n' : scr_label
scr_label := scr_label + "close->" + tostring(array.get(valsClose, 0)) + " open->" + tostring(array.get(valsOpen, 0)) + '\n'
if barstate.islast
lab_l = label.new(bar_index, high, scr_label, color=color.green, textcolor=color.white, style = label.style_labeldown)
label.delete(lab_l[1])
plot(close, color=color.new(color.white, 100))