I want to truncate the number of decimal places included in the number of contracts which are bought and sold in each order placed. For example if the indicator signals a buy of 1.5324 contracts can I truncate this number to 1.532 contracts? Is there any code I can include in my pine script so I can do this? Thank you
strategy(title="IN USE [bch-usdt] [strat cash <850usd>] [close <sma 100>]", default_qty_type=strategy.cash,
default_qty_value=850)
angle(_src) =>
rad2degree=100/3.14159265359 //pi
ang=rad2degree*atan((_src[0] - _src[1])/atr(14))
ma_slope=angle(sma(close, 100))
longCondition = crossover(sma(close, 1), sma(close, 100))
if (longCondition)
stop_level = close*0.95
strategy.entry("My Long Entry Id", strategy.long)
strategy.exit("TP/SL", "My Long Entry Id", stop=stop_level)
shortCondition = crossunder(sma(close, 1), sma(close, 100))
if (shortCondition)
strategy.close("My Long Entry Id")
plot(strategy.netprofit)