Download MetaTrader 5
To add comments, please log in or register
What is a social trading? Read the article to find that out!
ken
35
ken 2014.04.09 14:50 

Hi all,

My name is ken, actually i am a newbie in EA programming.

Wish to ask if my EA already containing below declaration in an EA and attach to EURUSD chart. Do i still need Marketinfo() to retrieve all those M30 data? Thanks in advance for the advise!!!

double gbpusdAwayUSD0 = iClose("GBPUSD", PERIOD_M30, 1);

double usdjpyHomeUSD0 = iClose("USDJPY", PERIOD_M30, 1);

double usdchfHomeUSD0 = iClose("USDCHF", PERIOD_M30, 1);

double gbpusdAwayUSD1 = iOpen("GBPUSD", PERIOD_M30, 1);

double usdjpyHomeUSD1 = iOpen("USDJPY", PERIOD_M30, 1);

double usdchfHomeUSD1 = iOpen("USDCHF", PERIOD_M30, 1);

qjol
3243
qjol 2014.04.09 15:02  
razordota:


My name is ken,

hi ken

i am a newbie in EA programming.

IMHO this is very helpful

Do i still need Marketinfo() to retrieve all those M30 data?

what for ?



Play video
Please edit your post.
For large amounts of code, attach it.

ken
35
ken 2014.04.09 15:08  

Hi qjol,

actually i wish to compare the USD currency strength against other such as JPY, GBP, CHF by using (M30 Close price-Open price method) before entering a position on EURUSD.

If USD gain >20pips each on JPY, GBP, CHF.... i will sell EURUSD, vice versa if USD loss 20pips

qjol
3243
qjol 2014.04.09 15:14  

then what for do you need

iClose("GBPUSD", PERIOD_M30, 1); //Close bar no. 1 = 1 bar before the current bar
whroeder1
13644
whroeder1 2014.04.09 15:20  
razordota:Do i still need Marketinfo() to retrieve all those M30 data?

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. You can only get the current chart pair/timeframe values with the predefineds. If you need other pairs or timeframes, that's one way.
  3. If you don't then no.
ken
35
ken 2014.04.09 15:25  

Hi qjol,

Thanks for your kindness

Actually i did insert the iClose("GBPUSD", PERIOD_M30, 1); into my EA.

My question is, i attach my EA on EURUSD chart, and inserting above code, would my EA able to get the GBPUSD M30 info prior proceed to my coding calculation for market entrance decision without the help from Marketinfo() function?....

qjol
3243
qjol 2014.04.09 15:26  

yes but It depends on what you are trying to achieve

for example if you the LOTSIZE on GBP you will have to use:

MarketInfo("GBPUSD", MODE_LOTSIZE);
ken
35
ken 2014.04.09 15:30  

Hi WHRoeder,

Thanks for your reply.

If that is the case, how will it the code look like in the predefined code for GBPUSD M30 open & close info? i'm totally newbie(without programming background)...haha

qjol
3243
qjol 2014.04.09 15:37  
MarketInfo can give you only the current actual information but can not give you for example yesterdays close
whroeder1
13644
whroeder1 2014.04.09 19:56  
razordota: code look like in the predefined code for GBPUSD M30 open & close info?
Any chart pair,TF
GBPUSD, M30 chart only
 iOpen("GBPUSD", PERIOD_M30, 1);
Open[1];
iClose("GBPUSD", PERIOD_M30, 1);
Close[1];
ken
35
ken 2014.04.10 03:48  
Hi qjol Thanks for the info and your great help Hi WHRoeder, I assume those iOpen/iClose declare inside start() but not head part of the program. Will try it again in my program. Thank you.
/
To add comments, please log in or register