Forums ProRealTime English forum ProOrder support Optimization moving average crossing strategy Reply To: Optimization moving average crossing strategy

#124301

Hi,

I´m using this code on a algo but with MA 12 and 34 i get an “division by 0” error when market is inactive. Can I prevent this by any meen?

My guesses is that it is the 34 MA that is the problem. I’ve seen someone else have the same Division 0 error on another algo and put in like: <>0 or something like that, but how do i code it on this one?

Thank you for great coding.