I am trying with a PineScript to find out dynamically the ATM strike price of Indian indices, say Nifty (nearest 50) or NiftyBank (nearest 100).
So my idea is simple, codewise:
screenerFun(offset, callOrPut, expiry) =>
// Strike selection
currAtm = (math.ceil(close / std) * std)
strike_float = currAtm + (offset * std)
strike = str.tostring(currAtm + (offset * std))
symbolRoot = ticker == 'CNXFINANCE' ? 'FINNIFTY' : syminfo.root
tickerSym = callOrPut ? symbolRoot + expiry + "C" + strike : symbolRoot + expiry + "P" + strike
callOrPut_float = callOrPut ? 1.0 : 0.0
atm_indication = offset == 0 ? 1.0 : 0.0
[cond, cmp, vwap, entry, sl, target, volumeVal, volDirection, BBWidth, BBWidthDir] = request.security(tickerSym, timeframeInput, screener_func())
arr = array.from(strike_float, callOrPut_float, cond, cmp, vwap, entry, sl, target, volumeVal, volDirection, BBWidth, BBWidthDir, atm_indication)
matrix.add_row(screenerMtx, matrix.rows(screenerMtx), arr)
Basically this line:
currAtm = (math.ceil(close / std) * std)
Where,
std is 50
But it gives an error saying I am not using a
An argument of ‘series float’ type was used but a ‘simple float’ is expected
How to overcome it?