This also includes a No Repaint function so the backtest should be as close to live trading as possible.
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.
First, if you just want to turn it off completely, set pyramiding to 0.
Second, if you still want pyramiding (I like it because if a bad trade happens it can average down or up a little bit), your moving average lengths might be too short. Remember the moving averages are looking at the candles of the alternate resolution. So if you have you chart set to 1 hour candles and the alternate resolution is 1min with the MA set to 10, there is 6 data points within that 1 hour candle. A lot can happen, it can be useful to see that high resolution if what you're trading is volatile, but if you're trading something that doesn't move very quickly it can confuse this bot (momentum will go up and down while the price didn't change enough to profit from). It's why I included the low volatility function (but the low volatility function is looking at the chart resolution).
Also do not check the box for "Recalculate after every trade" if pyramiding is active. You do need to have "Recalculate on every tick" selected to have it work on live data though.