Hello again, I'm trying to calculate a moving average of Open price every five candles, I have the following:
for (int i=0; i >= 5; i++){
ma += (Open(i));
}
ma= ma /5
I try the same with: "iOpen("EURUSD", PERIOD_M5,i)", but nothing seems to get stored into the ma variable.
Please advice I'm kind of stuck.
thanks...
Open() not working
-
- Posts: 103
- Joined: Sun Jan 02, 2011 6:05 pm
Re: Open() not working
omarloren wrote:Hello again, I'm trying to calculate a moving average of Open price every five candles, I have the following:
for (int i=0; i >= 5; i++){
ma += (Open(i));
}
ma= ma /5
I try the same with: "iOpen("EURUSD", PERIOD_M5,i)", but nothing seems to get stored into the ma variable.
Please advice I'm kind of stuck.
thanks...
I think it is very difficult to understand what your problem with the above partial statement. why don't you attach the complete source code for people to diagnose ?
- Tantalus
- Posts: 302
- Joined: Fri Mar 23, 2007 3:51 pm
- Contact:
Take this:
and change it to this:
The middle part of the for() block is a 'while', not an 'until'.
Code: Select all
for (int i = 0; i >= 5; i++)
ma += (Open(i));
ma = ma / 5
and change it to this:
Code: Select all
for (int i = 0; i < 5; i++)
ma += (Open(i));
ma = ma / 5
The middle part of the for() block is a 'while', not an 'until'.
Tantalus Research - Developing 21st Century Trading Systems.
Return to “Programming lessons”
Who is online
Users browsing this forum: No registered users and 32 guests