I think i may need to do a multidimensional array or a array with multiple variables.
The array need to contain symbol , period and state of lastTradeBar on that symboles period.
This is what i use now.
if(lastTradeBar!=Time[0])
But should it be something like this
if(lastTradeBarArray[sym,period,lastTradeBar]!= Time[0];
or
if(lastTradeBarArray[sym][period][lastTradeBar]!= Time[0];
But i'm not shure how to store those values in there or which one is correct.
The array need to contain symbol , period and state of lastTradeBar on that symboles period.
You do not. When thinking about multidimensional arrays, the first n-1 dimensions are about finding a value. The last dimension is the value(s). You can't do that because the first index (a string) is not compatible with the value (state).
Not compiled, not tested, just typed.
struct MyData{ string symbol; ENUM_TIMEFRAME period; yourENUM state; void set(string aSymbol, ENUM_TIMEFRAME aPeriod, yourENUM aState){ symbol=aSymbol; period=aPeriod; state=aState; } } MyData data[]; void addData(string aSymbol, ENUM_TIMEFRAME aPeriod, yourENUM aState){ int iData = ArrayLength(data); ArrayResize(data, iData+1); data[iData].set(aSymbol, aPeriod, aState); } int lookupData(string aSymbol, ENUM_TIMEFRAME aPeriod){ int iData = ArrayLength(data)-1; for(; iData >= 0; --iData) if(data[iData].symbol == aSymbol && data[iData].period == aPeriod) break; return iData; }
Not compiled, not tested, just typed.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
So I'm trying to create a Multi Currency Multi TimeFrame EA.
I've come so far that it loops thru currencies and Periods of my chose.
I send those to a Signal function that test the signal of my chosen indicator.
So far so good.
My problem is that if my SL takes out my order on the first bar it reopens the order and the then SL takes it out again and again and again.
when I just created a normal EA i could use the static datetime lastTradeBar; methed but I don't really know how to implement that in a Multi Currency Multi TimeFrame situation.
How do you guys solve this?