Hi,
First I apologize if my question was ever asked in this forum and I would be very grateful if you can point me to the answer.
OK, here is the question:
How can I get the indicator value from other timeframe?
What I want is: no matter which TF I'm in (either M15, M30, H1 or other), I want the EA to take the indicator value from (for e.g.) TF M5.
I have tried this:
double TheMain = iADX(NULL, 5, 15, PRICE_CLOSE, 0, 0);
but TheMain Value is always 0 if I'm not in TF5.
Is there any step I should do to get the value?
Thanks in advance for the help.
double iADX( | string symbol, int timeframe, int period, int applied_price, int mode, int shift) |
Hi,
First I apologize if my question was ever asked in this forum and I would be very grateful if you can point me to the answer.
OK, here is the question:
How can I get the indicator value from other timeframe?
What I want is: no matter which TF I'm in (either M15, M30, H1 or other), I want the EA to take the indicator value from (for e.g.) TF M5.
I have tried this:
double TheMain = iADX(NULL, 5, 15, PRICE_CLOSE, 0, 0);
but TheMain Value is always 0 if I'm not in TF5.
Is there any step I should do to get the value?
Thanks in advance for the help.
Use Print, Comment,
//+------------------------------------------------------------------+ //| ADXPeriodTESTER.mq4 | //| Copyright 2013, deVries | //| | //+------------------------------------------------------------------+ #property copyright "Copyright 2013, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- Comment(""); //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { //---- double TheMain5 = iADX(NULL, PERIOD_M5, 15, PRICE_CLOSE, 0, 0); double TheMain15 = iADX(NULL, PERIOD_M15, 15, PRICE_CLOSE, 0, 0); double TheMain30 = iADX(NULL, PERIOD_M30, 15, PRICE_CLOSE, 0, 0); Comment("M 5 ",TheMain5,"\n","M 15 ",TheMain15,"\n","M 30 ",TheMain30); //---- return(0); } //+------------------------------------------------------------------+
Test out if it is working
Use Print, Comment,
Test out if it is working
Thanks for the respond. I try it in Strategy Tester, and the result:
if I set the period to 15, TheMain15 gives value the others 0.
If I set the period to 5, TheMain5 gives value, the others 0
If period set to 30, TheMain30 gives value, the others 0
Thanks for the respond. I try it in Strategy Tester, and the result:
if I set the period to 15, TheMain15 gives value the others 0.
If I set the period to 5, TheMain5 gives value, the others 0
If period set to 30, TheMain30 gives value, the others 0
Show your code please.
OK, here is my code:
#define _UP 1
15 is the correct time frame enumeration value for the chart he wants. The only other problem I can think of is if his history data is not sufficient for the time frame he wants.
I think you're right, after download in the history center, now my code can run as expected. Thanks a lot.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
First I apologize if my question was ever asked in this forum and I would be very grateful if you can point me to the answer.
OK, here is the question:
How can I get the indicator value from other timeframe?
What I want is: no matter which TF I'm in (either M15, M30, H1 or other), I want the EA to take the indicator value from (for e.g.) TF M5.
I have tried this:
double TheMain = iADX(NULL, 5, 15, PRICE_CLOSE, 0, 0);
but TheMain Value is always 0 if I'm not in TF5.
Is there any step I should do to get the value?
Thanks in advance for the help.