Do i need to use Marketinfo()???

 

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);

 
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.

 

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

 

then what for do you need

iClose("GBPUSD", PERIOD_M30, 1); //Close bar no. 1 = 1 bar before the current bar
 
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.
 

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?....

 

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);
 

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

 
MarketInfo can give you only the current actual information but can not give you for example yesterdays close
 
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];
 
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.
Reason: