Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

Moving Averages
 Post subject: Moving Averages Post rating: 0   New post Posted: Thu 19 Sep, 2013, 07:28 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Hi

Moving average indicators are based on Price.

If one wished to create moving averages based on return (i.e. (Close - Open)/Open * 100) how would you go about it?

Bob M


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Thu 19 Sep, 2013, 07:43 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
See:
https://www.dukascopy.com/wiki/#Indicator_Calculation/Calculate_indicator_on_array


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Thu 19 Sep, 2013, 11:55 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Would anybody else care to comment further ?

Bob M

I find that being directed to read a whole lot of stuff that I don't fully understand not all that helpful :)


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Thu 19 Sep, 2013, 12:01 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
If you want to calculate the moving average over your own array of values then it is one way to do it. If you need something else, then please elaborate on your request and desirably supply your response with an example strategy.


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Thu 19 Sep, 2013, 20:07 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
OK

so if I wish to calculate MA(6) over 'return' rather than 'price':-

1) what exactly do I put in priceArr?

2) where does the time period 6 go?

Bob M


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Fri 20 Sep, 2013, 07:35 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
us_copiosus wrote:
1) what exactly do I put in priceArr?
It depends on your strategy logic.
us_copiosus wrote:
2) where does the time period 6 go?
Instead of 3, put here 6:
maIndicator.setOptInputParameter(0, 3);


 
 Post subject: Re: Moving Averages Post rating: 0   New post Posted: Fri 20 Sep, 2013, 20:49 
User avatar

User rating: 2
Joined: Fri 02 Mar, 2012, 22:08
Posts: 200
Location: New Zealand, Dunedin
Thank you

Sorted now :)

Bob M


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com