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.

iMAOnArray analogue
 Post subject: iMAOnArray analogue Post rating: 0   Post Posted: Fri 07 May, 2010, 12:51 

User rating: 0
Joined: Tue 09 Sep, 2008, 18:55
Posts: 9
Hi!

Is there an analogue of MetaTrader indicator:

double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)
(Calculation of the Moving Average on data stored in a numeric array. Unlike iMA(...), the iMAOnArray function does not take data by symbol name, timeframe, the applied price.)

Or how can I implement this code:
.....
buf1[i] = iRSI(NULL, 0, 10, PRICE_TYPICAL, i);
.....
buf2[j] = iMAOnArray(buf1, 0, 2, 0, MODE_SMA, j);
.....

Description of MetaTrader indicators:

double iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift)
Calculation of the Moving Average on data stored in a numeric array. Unlike iMA(...), the iMAOnArray function does not take data by symbol name, timeframe, the applied price. The price data must be previously prepared. The indicator is calculated from left to right. To access to the array elements as to a series array (i.e., from right to left), one has to use the ArraySetAsSeries function.
Parameters:
array[] - Array with data.
total - The number of items to be counted. 0 means whole array.
period - Averaging period for calculation.
ma_shift - MA shift
ma_method - MA method. It can be any of the Moving Average method enumeration value.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

double iRSI( string symbol, int timeframe, int period, int applied_price, int shift)
Calculates the Relative strength index and returns its value.
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol.
timeframe - Timeframe. It can be any of Timeframe enumeration values. 0 means the current chart timeframe.
period - Number of periods for calculation.
applied_price - Applied price. It can be any of Applied price enumeration values.
shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).

Kind regards,
Alex


 
 Post subject: iMAOnArray analogue Post rating: 0   Post Posted: Mon 07 Jun, 2010, 07:30 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Please try:

double[] smaresult = indicators.ma(instrument, Period.FIFTEEN_MINS , OfferSide.BID, IIndicators.AppliedPrice.MEDIAN_PRICE, 10, IIndicators.MaType.SMA, timeFrom, timeTill);


 
 Post subject: Re: iMAOnArray analogue Post rating: 0   Post Posted: Sat 29 Sep, 2012, 19:29 

User rating: 0
Joined: Mon 08 Aug, 2011, 13:52
Posts: 8
Location: United States,
I know this is an old post but I don't understand the response. i think you described how to solve only half the problem. That is generating buf1[i]. But i don't see a method for generating buf2[i].

(From fxprogrammer's post) How to implement this code:

buf1[i] = iRSI(NULL, 0, 10, PRICE_TYPICAL, i);
.....
buf2[j] = iMAOnArray(buf1, 0, 2, 0, MODE_SMA, j);

Thanks in advance,
termar


 
 Post subject: Re: iMAOnArray analogue Post rating: 0   Post Posted: Mon 01 Oct, 2012, 14:07 
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


 

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