im practising pine script, and im doing a simple strategy. but i got this error, can anyone help me? thanks !
//@version=5 strategy("Mi semaforo", overlay=true, margin_long=100, margin_short=100) mm_g = ta.sma(close, 5) mm_y= ta.sma(close, 10) mm_r = ta.sma(close, 20) alcista = (mm_g > mm_y) and (mm_y > mm_r) // bajista = (mm_g < mm_y) and (mm_y < mm_r) comprado = strategy.position_size > 0 if (not comprado and alcista) cantidad = math.round(strategy.equity, close) strategy.entry("Compra", strategy.long, cantidad) if (comprado and not alcista) strategy.close("Compra", comment="Venta") LINE OF ERROR = cantidad = math.round(strategy.equity, close)
ERROR = line 17: Cannot call 'math.round' with argument 'precision'='close'. An argument of 'series float' type was used but a 'simple int' is expected; line 17: Variable 'cantidad' is not found in scope '#global_#0', cannot register side effect