I would modify it like that:
// Heiken Ashi Candle Struct
#define ha 20 // Make this number at least 5 more than the number of candles you plan on analyzing struct heikenAshi { double haClose; double haOpen; double haHigh; double haLow; heikenAshi() { haClose = 0.0;haOpen = 0.0;haHigh = 0.0;haLow = 0.0; } }; heikenAshi haCandles[ha]; // Array of 'ha' Heiken Ashi candles with corresponding properties
Ovo:
Thank you for your help! If you don't mind, could you explain the purpose of putting the heikenAshi()... member in the struct? I'm a hardware engineer and know just enough programming to get myself in trouble!
I would modify it like that:
// Heiken Ashi Candle Struct
jt27:
Thank you for your help! If you don't mind, could you explain the purpose of putting the heikenAshi()... member in the struct? I'm a hardware engineer and know just enough programming to get myself in trouble!
It is a constructor (a method which is triggered after the structure allocation), and in this case it sets default values to the struct members. Otherwise the values would be undefined (not initialised).
Thank you for your help! If you don't mind, could you explain the purpose of putting the heikenAshi()... member in the struct? I'm a hardware engineer and know just enough programming to get myself in trouble!
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
I am trying to create an array of structs, everything I find online indicates there shouldn't be a problem with that, but I can't seem to get my code to compile when I try to do this. Here is what I am trying to do:
Any suggestions as to what I'm doing wrong?