Here I have used the official RSI strategy for demonstration, using the qty to place orders. Through strategy.equity, leverage and close price, and rounding, directly calculate the specific number of contracts need to be opened.

I hope you can enjoy solving the leverage problem, and I look forward to your pointing out my problems and shortcomings to me. Thank you.

Margin settings have been added, but note that because of TradingView's restrictions, the margin rate must be set to a constant, so it is necessary for the user to change the leverage while modifying the margin rate.

The default leverage is 2 and the margin burst rate is 80%, which can be modified by yourself.

The default leverage is 2 and the margin burst rate is 80%, which can be modified by yourself.