Search code examples
pine-scriptpine-script-v5

How to avoid computation in request.security_lower_tf


I am trying to avoid computation in request.security_lower_tf selectively by using a flag skip_lower_tf which whenever is set as true I want to not calculate/use request.security_lower_tf.

I tried skip_lower_tf?na:(request.security_lower_tf()), but it is not working, and even when I have the skip_lower_tf=true it seems that the computation still happens.

For example, when my chart timeframe is lower than the timeframe of security_lower_tf and skip_lower_tf=true I still get the error complaining about the timeframe of security_lower_tf should be lower than the chart timeframe. I am wondering how I can skip going through the security_lower_tf computation when I have skip_lower_tf=true


Solution

  • The following will do the job

    request.security_lower_tf(syminfo.tickerid, skip_lower_tf ? '' : timeframe, ...)