How to script indicator values between "0-5"

Hi Mathew/Team,

Can you please assist on the below. having few queries, I’m trying to script the below idea for backtesting but unable to put the Valid script.

  1. I want to script criteria when “RSI Indicator Turns Up between Values 45 to 50”, Per below I’m able to put only 1 value. How can I put this in the script, please?
    RSI
  2. Please assist, how to create a script for Bollinger Band? The candle should close Higher B.B and Entry if the Next candle cross/moves High of the previous candle(which is 1st candle closed above Higher B.B.)

Hi,

If you have not already done so please be sure to review and complete the free scripting courses here before attempting to build your own scripts. https://learn.optuma.com/scripting-courses/

For the RSI criteria you can use the following:

//Set RSI
V1 = RSI() ;
//Check RSI value is between 45 - 50
V2 = V1 >= 45 and V1 <= 50;
//Check RSI Turns Up
V3 = V1 TurnsUp ;
//Check both criteria are met
V2 and V3

This will only show results where the RSI turns up while it is within a value of 45 - 50.

For Bollinger bands I am not 100% sure on the settings you are using, or if the current candles needs to Close higher than the high of the previous candle or the close? I’ve added a sample script below with comments on each line is doing, you can adjust it if need be.

//Set Bollinger Band Settings with Upper Line
V1 = BB(STDDEV=1.000000).UpperLine;
//Find where Close Crosses Above the BB Upper Line
V2 = CLOSE() CrossesAbove V1;
//Close is Higher than previous Candles High
V3 = CLOSE() > HIGH(1) ;
//After Closing above upper BB line is close higher than previous candles high
V2[1] == 1 and V3