Page 1 of 1

MA Crossover shown in price Chart

PostPosted: Mon Feb 05, 2018 7:24 pm
by robbieyoung
Hi,

As I can have 12 chart windows open at any one time I don't have space to show the MA Crossover chart below the price chart.

I would like an indicator to plot a single line on the price chart itself whereby if the bar closes above this line then I know the fast MA is greater than the slow MA and similarly if the bar closes below this line I know the fast MA is below the slow MA.

ie. the line shows the price where the fast MA will be exactly equal the slow MA.

The equation for the line in the current open bar is:

F = 10 (Fast MA Periods)
S = 20 (Slow MA Periods)

Price = ( S * F * MA(S-1) - S * F * MA(F-1) ) / ( S - F )

Price = ( 20 * 10 * MA(19) - 20 * 10 * MA(9) ) / ( 20 - 10 )

Where MA(19) and MA(9) are the MA of the previous 19 and 9 closed bars respectively.
(Note the MA calculation does not include the current (Open) bar)

I had looked at trying to adapt the MVA and the MACD indicators but quickly realised I dont know enough about lua to even attempt it.

Thanks in advance for any help you might be able to give.

Re: MA Crossover shown in price Chart

PostPosted: Tue Feb 06, 2018 4:54 pm
by Apprentice