Post subject: EMA values differ between chart and strategy
Post rating: 0
Posted: Fri 10 Oct, 2014, 21:50
User rating: 0
Joined: Fri 10 Oct, 2014, 00:35 Posts: 58 Location: New Zealand, Auckland
Hi
I am writing a simple ma cross strategy using an ema(8) cross over sma(20). I notice that the values for the ema in the strategy are different from those on the chart. (The values for the sma agree.) I think this is due to the number of historical bars used to calculate the ema.
Is it possible to set the number of bars for calculation of the ema? I only need to use the last value.
I am using JForex. This is not a "Visual JForex" question, but I don't know if this is the correct place to ask it. (My first need for support.) If it's not, please advise where such strategy programming questions should be asked.
Cheers Tony
tcsabina
Post subject: Re: EMA values differ between chart and strategy
Probably you use difference settings (filters, etc) on the chart. This might help.
Also, this is an interesting topic about 'unstable period', which is also affecting indicator calculation.
Hope this helps.
Jellybean
Post subject: Re: EMA values differ between chart and strategy
Post rating: 0
Posted: Tue 14 Oct, 2014, 03:46
User rating: 0
Joined: Fri 10 Oct, 2014, 00:35 Posts: 58 Location: New Zealand, Auckland
Thank you, tcsabina.
You are correct; the big differences I saw were due to charts using the filter WEEKENDS, but strategy using NO_FILTER.
I knew to check them, but I am new to the platform and it took a long time for me to realise what filter the charts were using. I understand that now.
The article about unstable periods addresses exactly what I meant when I asked how many historical bars were used to calculate the EMA. It's very interesting, but with a short EMA, it is not an issue.
Thanks for your help. I realise now that learning the platform means also becoming very familiar with the right forums!