how to create a coding LWMA 5 Closed crossover LWMA 5 Previous Indicator's Data?

 

The indicator setting is like this:

1. Moving Average Period:5  Method: Linear Weighted Apply to: Close

2. Moving Average Period:5  Method: Linear Weighted Apply to: Median

    then change Apply to: Previous Indicator's Data

How to create a indicator that can give us signal when this two MA crossover?

Thank.


Files:
gbpjpy-h4.png  150 kb
 

You can not specify "Median" as the applied price of a signal. Because the signal is the average of MA.

int i,limit;

if(prev_calculated==0)
   limit=rates_total-5;
else
   limit=rates_total-prev_calculated+1;

for(i=limit; i>=0; i--)
   MA_Buffer[i]=iMA(NULL,PERIOD_CURRENT,5,0,MODE_LWMA,PRICE_CLOSE,i);

for(i=limit; i>=0; i--)
   SIG_Buffer[i]=iMAOnArray(MA_Buffer,0,5,0,MODE_LWMA,i);