BCParticipant
Master
My trading system is fine on back test, but below error message appear when go live.
“The trading system was stopped due to a division by zero during the evaluation of the last candlestick. Please add protections to your code to prevent divisions by zero.”
Can anyone help on this issue? Thanks.
WingParticipant
Veteran
Usually, this problem is because you have a variable that you initiate as zero, or simply do not give a set value to at first. When you try to divide a number or another variable with this zero variable, an error is returned. So my first suggestion, look at all points in the system where you divide something, then make sure nothing is ever divided by zero.
BCParticipant
Master
Hi Wing
Thanks for your advise, I fixed the problem, it caused by preloadbars issue, my previous setting is 150, its ok when change to 1000.