Hi,
anyone can help me code ? to find the Value of an interception point.
thanks,
:51:
You will need to be a little more clear- I see a red arrow - but what is intercepting?
if you just want an ma cross - something like this?
double MovAv1=iMA(NULL,0,MaPeriod,0,MODE_SMA,PRICE_CLOSE,shift);
double MovAv2=iMA(NULL,0,MaPeriod,0,MODE_SMA,PRICE_CLOSE,shift+1);
if(MovAv1>MovAv2) buy
if(MovAv1<MovAv2) sell
That is close but will never work. There is no constraint on when the crossover occurred. So it will evaluate true for every bar, not just when the crossover occurs. There needs to be extra logic to check if the previous bar’s MAs were opposite. Something like:
if (FastMA1 > SlowMA1 && FastMA2 < SlowMA2).