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.

Output MACD from 5 minutes on 1 minute
 Post subject: Output MACD from 5 minutes on 1 minute Post rating: 0   New post Posted: Fri 09 Sep, 2016, 14:23 

User rating: 0
Joined: Thu 12 Dec, 2013, 09:24
Posts: 21
Location: Ukraine, Kyiv
I have following question.
In MT4 there is following function:

double iMACD(
string symbol, // symbol
int timeframe, // timeframe
int fast_ema_period, // Fast EMA period
int slow_ema_period, // Slow EMA period
int signal_period, // Signal line period
int applied_price, // applied price
int mode, // line index
int shift // shift
);

so, in my code, if I need to get macd value from current timeframe I can use following code:

double val = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);

If indicator or strategy work at 1 minute time frame, but I want to see macd at 5 minute time frame I can use the following comand:

double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,0);

If I want to get value of previous 5 minutes time frame, I can use following code:
double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,1);
If I want to get value of 10 minutes before, I can use this line:
double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,2);

Regarding to this I have two questions:
1. How to get value of macd from time-frame different from which custom indicator is executed?
2. How to get value of macd from time-frame different from which custom indicator is executed and if time frame is not standard ( for example timeframe of 28 minutes ).
3. How to get those values while implementing IStrategy and IIndicator?


 
 Post subject: Re: Output MACD from 5 minutes on 1 minute Post rating: 0   New post Posted: Wed 14 Sep, 2016, 10:40 

User rating: 0
Joined: Thu 12 Dec, 2013, 09:24
Posts: 21
Location: Ukraine, Kyiv
Does anybody have any idea?
P.S.
I know about the following url:
https://www.dukascopy.com/wiki/#Add_ind ... ened_chart

but it says nothing about usage of indicators during implementing IIndicator.


 

Jump to:  

  © 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