I have a very low-lag indicator and I use D1, H4, H1, M30, M15 and M5 timfeames to calculate the indicator value. I use iCustom function a lot i.e. the EA calculates the indicator value is a loop as below for every tick!!
The function below "get_trend_values" gets called for every tick.
Q1. Which timeframe I should use for strategy testing.
Q2. While running this EA on a regular chart which timeframe I should use?
Q3. Do you have any suggestions for reducing the memory usage as the strategy tester is going out of memory.
#define TREND_INDICATOR "LowLagLine"
#define NTIMEFRAME 6
#define D1_INDEX 0
#define H4_INDEX 1
#define H1_INDEX 2
#define M30_INDEX 3
#define M15_INDEX 4
#define M5_INDEX 5
int timeframes[NTIMEFRAME] = { PERIOD_D1, PERIOD_H4, PERIOD_H1, PERIOD_M30, PERIOD_M15, PERIOD_M5 };
int prev_value[NTIMEFRAME];
int curr_value[NTIMEFRAME];
void
get_trend_values()
{
int i;
double v1, v2, v3, v4, v5, v6;
for ( i = 0; i < NTIMEFRAME; i++ ) {
curr_value[i] = TREND_UNKNOWN;
prev_value[i] = TREND_UNKNOWN;
v1 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 0, 0 );
v2 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 1, 0 );
v3 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 2, 0 );
v4 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 3, 0 );
v5 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 4, 0 );
v6 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 5, 0 );
if ((v1 > quote_spread)||(v2 > quote_spread)) {
if ((v3 < quote_spread)&&(v4 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
curr_value[i] = TREND_BULLISH;
}
}
if ((v3 > quote_spread)||(v4 > quote_spread)) {
if ((v1 < quote_spread)&&(v2 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
curr_value[i] = TREND_BEARISH;
}
}
v1 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 0, 1 );
v2 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 1, 1 );
v3 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 2, 1 );
v4 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 3, 1 );
v5 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 4, 1 );
v6 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 5, 1 );
if ((v1 > quote_spread)||(v2 > quote_spread)) {
if ((v3 < quote_spread)&&(v4 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
prev_value[i] = TREND_BULLISH;
}
}
if ((v3 > quote_spread)||(v4 > quote_spread)) {
if ((v1 < quote_spread)&&(v2 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
prev_value[i] = TREND_BEARISH;
}
}
}
}
I am still facing problem of low memory. I tried reducing the bars in chart to a smaller value but still I am facing this problem.
Has anyone here tried this kind of EAs
Thx
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a very low-lag indicator and I use D1, H4, H1, M30, M15 and M5 timfeames to calculate the indicator value. I use iCustom function a lot i.e. the EA calculates the indicator value is a loop as below for every tick!!
The function below "get_trend_values" gets called for every tick.
Q1. Which timeframe I should use for strategy testing.
Q2. While running this EA on a regular chart which timeframe I should use?
Q3. Do you have any suggestions for reducing the memory usage as the strategy tester is going out of memory.
#define TREND_INDICATOR "LowLagLine"
#define NTIMEFRAME 6
#define D1_INDEX 0
#define H4_INDEX 1
#define H1_INDEX 2
#define M30_INDEX 3
#define M15_INDEX 4
#define M5_INDEX 5
int timeframes[NTIMEFRAME] = { PERIOD_D1, PERIOD_H4, PERIOD_H1, PERIOD_M30, PERIOD_M15, PERIOD_M5 };
int prev_value[NTIMEFRAME];
int curr_value[NTIMEFRAME];
void
get_trend_values()
{
int i;
double v1, v2, v3, v4, v5, v6;
for ( i = 0; i < NTIMEFRAME; i++ ) {
curr_value[i] = TREND_UNKNOWN;
prev_value[i] = TREND_UNKNOWN;
v1 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 0, 0 );
v2 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 1, 0 );
v3 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 2, 0 );
v4 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 3, 0 );
v5 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 4, 0 );
v6 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 5, 0 );
if ((v1 > quote_spread)||(v2 > quote_spread)) {
if ((v3 < quote_spread)&&(v4 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
curr_value[i] = TREND_BULLISH;
}
}
if ((v3 > quote_spread)||(v4 > quote_spread)) {
if ((v1 < quote_spread)&&(v2 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
curr_value[i] = TREND_BEARISH;
}
}
v1 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 0, 1 );
v2 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 1, 1 );
v3 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 2, 1 );
v4 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 3, 1 );
v5 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 4, 1 );
v6 = iCustom( this_sym, timeframes[i], TREND_INDICATOR, 5, 1 );
if ((v1 > quote_spread)||(v2 > quote_spread)) {
if ((v3 < quote_spread)&&(v4 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
prev_value[i] = TREND_BULLISH;
}
}
if ((v3 > quote_spread)||(v4 > quote_spread)) {
if ((v1 < quote_spread)&&(v2 < quote_spread)&&(v5 < quote_spread)&&(v6 < quote_spread)) {
prev_value[i] = TREND_BEARISH;
}
}
}
}