'Remove crossed line - but on the next day

My script removes crossed lines - unfortunately the moment they get crossed. Is there a way to keep that line for the remaining day/remove on start of new day?

...

    bool  lineCrossed =  high >= lineLevel and low <= lineLevel

    if lineCrossed                                              
        line.delete(array.get(_line,i))

...



Solution 1:[1]

Wrapping the logic into following does the trick.

isToday = false

if year(timenow) == year(time) and month(timenow) == month(time) and dayofmonth(timenow) == dayofmonth(time)
    isToday := true

This allow to do something like this

bool  lineCrossed =  high >= lineLevel and low <= lineLevel

if lineCrossed
    if isToday
        doThis
    else                                      
        line.delete(array.get(_line,i))

('isToday' was provided by @Pugazh as solution to a previous issue he raised)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1