Live Trading is used to force the strategy to erase all backtest trade data and begin new trade data from the current bar.
Realtime Code - is used to lock-in this bar so that a page refresh will not reset where Live Trading starts as it calculates this again on refresh. You can save this realtime code for future use to look at backtest data for the bar you started trading at.
Notes and usages:
The purpose of Live Trading is primarily for bots that use the strategy signals to calculate quantities for opening trades.
For instance, if you do NOT use Live Trading, you will find that your starting equity will not be your current equity value in real time. By engaging live trading, you allow the equity to be exact to what it should be right now when you start trading.
In this way, you can use Live Trading to send a value like {{strategy.order.contracts}} placeholders in your Tradingview alerts to your bot and send accurate quantities for opening trades.
This can also be a useful way to see how well your trading goes starting from a specific point in time.