# Tutorial 202 | Calculate price to reach a user input RSI value

Tutorial 202 seeks to look at the RSI calculation and calculate what price (this bar) needs to be for the RSI to reach (or go down to) a specific value.

To achieve this the calculations:

RSIVal = 50 * ( ChgRatio + 1 )
where ChgRatio = NetChgAv[1] + Smooth * ( Price – Price[1] – NetChgAv[1] ) divided by TotChgAv = TotChgAv[1] + Smooth * ( AbsValue( Price – Price[1] ) – TotChgAv[1] )

are solved for Price (i.e. price this bar). Because the above formulae includes AbsValue( Price – Price[1] ) we actually need to solve for both Price – Price[1] and Price[1] – Price.

There is then an option to plot the appropriate value (i.e. if Price > Price[1] the Value calculated using Price – Price[1], otherwise the value calculated using Price[1] – Price) with a thicker line (PlotBoth set to TRUE) otherwise both lines are plotted the same thickness (PlotBoth set to FALSE).

This program’s inputs are Price, Len (the length of the RSI), TgtRSI (the RSI value that the program is targeting, and PlotBoth (see above).

To verify the program, it is useful to have the standard TradeStation RSI indicator applied to a subgraph as can be seen in the images on this page. This is not built into the tutorial 202 program.