Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
859 B
6
Indexable
Never
// _tpo_chart is an array of float
// _limit_low_ticks is a float

// this function compiles. If I uncomment line 16 it does not work. why?

update_tpo_chart(_tpo_chart, _limit_low_ticks) =>
    _high_ticks = high/syminfo.mintick
    _low_ticks = low/syminfo.mintick
    
    _tmp = _limit_low_ticks
    n = array.size(_tpo_chart)
    for i=0 to n
        if _tmp > _high_ticks
            break
        _tmp += tpo_size_ticks
        // array.set(_tpo_chart, i, array.get(_tpo_chart,i)+increment)
        
    _tmp := _limit_low_ticks + array.size(_tpo_chart)*tpo_size_ticks
    while _tmp < _high_ticks
        _tmp += tpo_size_ticks
        array.push(_tpo_chart,increment)
        
    _tmp := _limit_low_ticks
    while _tmp > _low_ticks
        _tmp -= tpo_size_ticks
        array.insert(_tpo_chart,0,increment)
    
    _tmp