HOW TO USE: This script is designed to be used on MES primarily. ES works as well but much more capital is needed. 3000 per contract is the recommended amount of initial capital. This number is a combination of the maintenance requirements to hold a contract through the settlement period and an additional amount for any drawdown. 1k maintenance + 2k drawdown buffer. This is a conservative estimate. You may need to change this to fit your individual broker requirements and risk tolerance.
Depending on the signal and how it is filtered the script will sometimes reverse a position or close it. Be mindful of which.
An important note is to not decrease the number of contracts traded once you have upped the position size if you plan to increase as the profit allows.
SIMULATION: I've included an option to see the compounding and changes in position size according to the HOW TO section. If you have access to "Deep Backtesting" option the results will be clearer. The current limitations of the data provided by TradingView at the 5m resolution limits the deep backtest to just shy of 1 year worth of trades.
The initial number of contracts to be traded can be changed to fit your own account size you wish to trade. You may also wish to see how it builds from just a single contract and building up based off profit alone. In that case leave the initial size as 1.
The buffer size is the amount of capital required to increase the position size. You may wish to increase risk by lowering this number or have a more conservative one by increasing it.