You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
in an EA circumventing the need for input values for each indicator.
The alternative in his backtester is to manually edit every indicator
with a signal buffer .
Try this a bit straightforward but the only approach possible so far.
Outputs:
ENUM elements:
Count=3
0 x1=-10
1 x2=0
2 x3=11
It's important to specify reasonable values for parameters start and stop , because the cycle from minimal to maximal integer value (which is used by default when the parameters are skipped) executes tooooo slow taking into account that string functions are used inside.
bool AddEnum(ENUMTYPE enumIn) {
enumIn = 0;
//iterate through enum and add as combo box
for(int i = 0; i<sizeof(enumIn); i++, enumIn++) {
m_list.AddItem(EnumToString(enumIn),i);
PrintFormat("adding %i = %s", i, EnumToString(enumIn));
}
return(0);
}
I added this to the CComboBox class, so I could pass in any ENUM type, and it would add it as a combo box.
But you can change it to do what you need.
The problem is, if you don't pass an ENUM and pass something like a double or float, you might crash your app.
I don't think there is any way to check the datatype passed.
bool AddEnum(ENUMTYPE enumIn) {
enumIn = 0;
//iterate through enum and add as combo box
for(int i = 0; i<sizeof(enumIn); i++, enumIn++) {
m_list.AddItem(EnumToString(enumIn),i);
PrintFormat("adding %i = %s", i, EnumToString(enumIn));
}
return(0);
}
I added this to the CComboBox class, so I could pass in any ENUM type, and it would add it as a combo box.
But you can change it to do what you need.
The problem is, if you don't pass an ENUM and pass something like a double or float, you might crash your app.
I don't think there is any way to check the datatype passed.
Yes it does, oops. I just noticed that.
It just so happens when I made this, the ENUM I was using actually had 4 properties :\
enum Combolist1{item1, item2, item3, item4, item5};
for(int i = 0; GetLastError()==0; i++) {For example, there has an enum definition:
enum ENUM_FRUIT {APPLE, BANANA, GRAPE};
Next, I want to use it in loop:
FRUIT_FIRST=APPLE, FRUIT_LAST=GRAPE};
for (ENUM_FRUIT i = APPLE; i <= FRUIT_LAST; ++i) {
Print(EnumToString(i));
}
#define FRUIT_FIRST APPLE
#define FRUIT_LAST GRAPE
for (ENUM_FRUIT i = APPLE; i <= FRUIT_LAST; ++i) {
Print(EnumToString(i));
}
PERIOD_M1, PERIOD_M2, PERIOD_M3, PERIOD_M4, PERIOD_M5, PERIOD_M6,
PERIOD_M10, PERIOD_M12, PERIOD_M15, PERIOD_M20, PERIOD_M30, PERIOD_H1,
PERIOD_H2, PERIOD_H3, PERIOD_H4, PERIOD_H6, PERIOD_H8, PERIOD_H12,
PERIOD_D1, PERIOD_W1, PERIOD_MN1};
ENUM_TIMEFRAMES next(ENUM_TIMEFRAMES curr){
for(int i=0; gcPeriods[i] != curr; ++i){}
return gcPeriods[i+1];
}
Bad design of what
it mean number of member store in enum ?
I know this conversation is quite old but here is an easy way to fill an array of any enum type.
Just adding my solution for future generations on how I've solved this.
So the problem is knowing the number of entries in the enum dynamically with the ability to add or remove enum values. I need to know this for creating fixed sized arrays with enum values as the array index. What I tend to do is add a reserved value at the end of the enum that is only ever used as a length value. Here's an example.
This is nice and easy because you don't need to be fixed to the last entry everywhere likeor you could add more entries to the end of the enum and the array and loop will still work.