Hi. I am trying to bound a value in a custom code (could be in a script also). I’m attempting to bound the top value plotted to 35. This doesn’t work but should provide the algorithm I am trying to implement.
MIN(SPX:WI, 35) … to print the SPX value or 35 if SPX is higher than 35.
Of course, this does not make sense to bound the SPX to at high of 35 - but it is just a simple example.
You can use an IF(condition, value if true, value if false) statement for this, ie if SPX < 35 use SPX value, else use 35.
IF(CLOSE() < 35, CLOSE(), 35)
Here is an example of a watchlist column that uses the highest value between the closing value and the 13 period exponential moving average, using the following formula: