Help with one line of code please

So can someone provide code to replace my english/code compilation

I am looking for usage of for example G/U information - when my indicator is attached to a E/U chart -is this possible?

Something like this for example.

if (closeE/U[1] > openE/U && closeG/U[1] is < openG/U[1])

edited:::::
oh maybe I just found something to try will this work? I can’t test it now I am at work

if (iclose(Eur/Usd)[1] > iopen(Eur/Usd)[1] && iclose(Gbp/Usd)[1] < iopen(Gpb/Usd)[1])

if (iclose(“EURUSD”,NULL,1) > iOpen(“EURUSD”,NULL,1) && iclose(“GBPUSD”,NULL,1) < iOpen(“GBPUSD”,NULL,1)
{
//Add your function here
}

NULL = any time frame, if you want to check it on the M5 chart then replace NULL with 5, 60 for the H1 chart, etc.
The number after the NULL, is how many bars from the current bar, 0 would be the current bar, 1 would be the previous bar, etc.

Hope this helps.

Your ‘english’ code is called pseudo code in the business where you use some kind of notation to describe algorithmic (set of rules) logic.

What you’re trying to do looks like this:

if((iClose(“EUR/USD”, PERIOD_15, 1) >
iOpen(“EUR/USD”, PERIOD_15, 1)) &&
(iClose(“GBP/USD”, PERIOD_15, 1) <
iOpen(“GBP/USD”, PERIOD_15, 1))
{
// action if true
}

You can replace the first pair of symbols with NULL (no quotes) to refer to the current symbol the EA is attached to.

You can replace the period parameter with 0 to refer to timeframe current EA is attached to or any one in this list: Chart Timeframes - Chart Constants - Constants, Enumerations and Structures - MQL4 Reference

The '1’s mean previous closed candle, 0 would be current forming candle, 2 would be 2nd to last closed/formed candle and so on.

Your EA can refer to other symbols but will not receive tick data or any alerts telling you when other (non-attached) symbols are updated.

Hope this helps.

Wowser - all great info - and exactly what I was looking for - -thanks so much - however one little item concerned me

Your EA can refer to other symbols but will not receive tick data or any alerts telling you when other (non-attached) symbols are updated.

But I think what I am trying to accomplish will work fine.
Does the above statement mean – for example if attached to a E/U chart - -and G/U tic tic tics away - - since I am attached to the G/U - the EA won’t ‘see’ or register those G/U tics? But once the E/U does its tic - -then it grabs G/U info?

Geez hope that made sense.

Made sense (despite the typo) and yes means what you said.

Your code is controlled by the ticks coming in on your attached chart.

It’s a mute point for the most part but in theory if your EUR/USD ticks jam up your code does too until they start again.

If the same happens to GBP/USD your EA code will use the '1’s blindly (last closed bar regardless). So if you plan to use real money you want to check the open bar times (at least to the minute) of the bars (previously closed) you are querying and comparing to make sure your checks are on corresponding bars.

Hope that makes sense.

Edited to reduce inconvenience:

iTime(Symbol, Period, Shift) lets you grab the open time.

TimeMinute(iTime(Symbol, Period, Shift)) lets you grab the open minute.

All depends what periods you are comparing.

iTime can be replaced by Time[n] to get open times for current symbol and period EA is attached to where n=0 is the current forming, n=1 is the previously closed.
TimeMinute(Time[n]) would extract the minute.

More info here:

http://docs.mql4.com/series/iTime

http://book.mql4.com/functions/datetime

http://docs.mql4.com/predefined/variables/Time