PineScript Why the request.securiry() work on D1 and doesnt on lower TF?

22 views Asked by At

Im try to get daily ATR for last 5 days. Code work perfect on D1 but take another result on lower timeframes. Why? Seems like [dh, dl] on lower TF contains only current day info

[dh,dl] = request.security(syminfo.tickerid, "D", [high,low], lookahead=barmerge.lookahead_on)
if barstate.isrealtime
    log.info("==============")
    log.info(str.tostring( dh[0] ))
    log.info(str.tostring( dh[1] ))
    log.info(str.tostring( dh[2] ))
    log.info(str.tostring( dh[3] ))
    log.info(str.tostring( dh[4] ))

If run this code on 1D, result is (expected):

[2024-03-28T14:47:27.614+03:00]: 1.08278
[2024-03-28T14:47:27.614+03:00]: 1.0839
[2024-03-28T14:47:27.614+03:00]: 1.08643
[2024-03-28T14:47:27.614+03:00]: 1.08424
[2024-03-28T14:47:27.614+03:00]: 1.0868

But if run it on 5 (5 min), than:

[2024-03-28T14:49:22.420+03:00]: 1.08278
[2024-03-28T14:49:22.420+03:00]: 1.08278
[2024-03-28T14:49:22.420+03:00]: 1.08278
[2024-03-28T14:49:22.420+03:00]: 1.08278
[2024-03-28T14:49:22.420+03:00]: 1.08278
0

There are 0 answers