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

#122790
Jan

Hi Nonetheless,  thanks for the reply, not sure what you meant ” @jan — forget my query about the alteration to the code, of course it only has to be added once at the beginning of the list. Brain fog.”

Have a nice weekend.

 

To avoid comparing the same MA (assuming the periods remain fixed), which is then meaningless, the very simple code is:

//Before all average definitions:

if MAType <> MATypeV2 then

 

//after all average definitions

Endif

You have to do this code AROUND all averages, both MAType and MATypeV2 in my opinion.

I think that if you code it only around the MAType defined averages, the first set,  the strategy optimizing would give an error because when both (MAType and MATypev2) are the same,  MAType would be excluded and undefined, which results in Nothing (MAType) crossing a average MATypeV2, which should give a error.