33 std::string
indicator_labels_[] = {
"Null",
"StockCSV",
"StockInst",
"Volume",
"SMA",
"EMA",
"WMA",
"MACD",
"BOLL",
"RSI",
"AD",
"STOCHF"};
35 int indicator_nb_param_[] = { 0, 0, 0, 0, 1, 1, 1, 3, 3, 1, 0, 2};
37 int indicator_nb_input_[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 3};
39 int indicator_nb_output_[] = { 0 , 4 , 1 , 1, 1, 1 , 1, 3, 3, 1, 1, 2};
40 bool bool_default_[] = {
false,
false,
false,
false,
false,
false,
false,
true,
true,
true,
false,
true};
42 int default_value_[][3] = { {}, {}, {}, {}, {}, {}, {},{12,26,9}, {5,2,2},{14},{}, {5,3}};
45 char descp_[][12] = {
"",
"LC0",
"LC0",
"LBR",
"P0B",
"P0B",
"P0B",
"KP0RP0BLBR",
"KP0VP0BP0V",
"P",
"P",
"PP"};
59 std::vector<std::string> tmp_vec;
60 for(
unsigned int i=1; i<
nb_label; i++)
91 std::cout <<
"nb_output in GetDefaultValues " <<
nb_output() << std::endl;
94 std::vector<int> vec_return;
105 std::cout <<
"Entry Indicator::GetDescription " << Utils::toString<std::string>(
descp_[
v_]) << std::endl;
108 return Utils::toString<char*>(
descp_[
v_]);
115 std::cout <<
"\nEntry Indicator::parse_description\n" << std::endl;
118 std::vector<std::string> desc_string;
119 std::string charact, charact2, charact3;
121 std::string full_descp_str;
122 std::string sub_string;
125 std::cout <<
"full descp " << full_descp_str << std::endl;
127 for (
unsigned int i = 0; i < full_descp_str.size(); ++i) {
136 if ( ( i == 0 ) && ( (full_descp_str[0]) ==
'K') ) {
137 std::string local_str;
138 local_str = full_descp_str[0];
141 std::cout <<
"set special for K charact [0]" << full_descp_str[0] << std::endl;
146 desc_string.push_back( local_str );
156 sub_string = full_descp_str.substr( i, 3 );
173 desc_string.push_back( sub_string );
182 std::cout <<
" summary parse_description " << std::endl;
183 for (
unsigned int i = 0; i < desc_string.size(); ++i ) {
184 std::cout <<
" i " << i <<
" " << desc_string[i] << std::endl;
207 int size_int=
sizeof(int(1));
220 std::cout <<
"machine dependent size_int " << size_int <<
"size value " << size << std::endl;
222 for (
int i=0;i<size;i++)
236 std::vector<std::string> vec_substr;
242 if ( vec_substr[0] ==
"StockCSV" ) {
247 else if ( vec_substr[0] ==
"StockInst" ) {
250 else if ( vec_substr[0] ==
"SMA" ) {
255 else if ( vec_substr[0] ==
"EMA" ) {
259 else if ( vec_substr[0] ==
"WMA" ) {
264 else if ( vec_substr[0] ==
"SimpleData" ) {
268 else if ( vec_substr[0] ==
"Volume" ) {
272 else if ( vec_substr[0] ==
"MACD" ) {
276 else if ( vec_substr[0] ==
"BOLL" ) {
280 else if ( vec_substr[0] ==
"RSI" ) {
284 else if ( vec_substr[0] ==
"STOCHF" ) {
288 else if ( vec_substr[0] ==
"AD" ) {
293 std::cout <<
"Error No Match in Indicator::GetIndicator, return Indicator::Null " << std::endl;
300 return o << c.
label ();
307 std::cout <<
"Indicator::Set " << str_name << std::endl;
309 std::string str_indic;
315 std::string::size_type lastPos = str_name.find_first_not_of(delimiters, 0);
317 std::string::size_type pos = str_name.find_first_of(delimiters, lastPos);
320 while (std::string::npos != pos || std::string::npos != lastPos) {
324 std::cout << str_name.substr(lastPos, pos - lastPos) << std::endl;
325 tmp_str=str_name.substr(lastPos, pos - lastPos);
332 std::cout <<
"param " << str_name.substr(lastPos, pos - lastPos) << std::endl;
333 tmp_str=str_name.substr(lastPos, pos - lastPos);
334 tmp_int= Utils::fromString<int>(tmp_str);
335 param.push_back(tmp_int);
338 lastPos = str_name.find_first_not_of(delimiters, pos);
340 pos = str_name.find_first_of(delimiters, lastPos);
355 if ( str_color ==
'B')
return 600;
356 else if ( str_color ==
'R' )
return 632;
357 else if ( str_color ==
'V' )
return 880;
366 if ( str_color ==
'B')
return 255;
367 else if ( str_color ==
'R' )
return 16711680;
368 else if ( str_color ==
'V' )
return 9568511;
369 else return 16711680;
375 std::cout <<
"v_ " <<
v_ << std::endl;
Value FindValue(std::string) const
static Indicator const STOCHF
std::vector< std::string > parse_description() const
Utility function to parse the description.
int indicator_nb_output_[]
static std::vector< std::string > GetListAllIndicator()
Get a list of all indicator's label.
"Clever" enumeration of the ListDataStock type : StockCSV, Volume, EMA, BOLL,...
int nb_param() const
Nb of parameters necessary to be computed.
void Set(std::string str_name, std::vector< int > ¶m)
bool HasDefaultValues() const
Test functions if default values are provided.
static Indicator const Null
Predefined static instances of the class.
static Indicator const WMA
int MakeEColor(const char str_color)
bool NeedToComputeTA() const
Test function if this indicator is computed with TALib interface.
static Indicator const MACD
Group general functions to convert to/from string, split line...
static Indicator const AD
static Indicator const RSI
int indicator_nb_input_[]
static Indicator GetIndicator(const std::string &str_name)
Constructor with a string label.
int MakeColor(const char str_color)
static Indicator const Volume
int nb_output() const
Nb of ListDataStock output of TALib computation.
void Change(int new_value)
static Indicator const StockInst
int indicator_nb_param_[]
std::string indicator_labels_[]
static Indicator const EMA
Value
Internally define an enumeration.
static Indicator const StockCSV
int nb_input() const
Nb of ListDataStock input to be computed.
static Indicator const BOLL
std::string GetDescription() const
Graphical description.
Declare all indicators (historical data and technical indicators) which can be computed and visualize...
std::vector< int > GetDefaultValues() const
Get the default values, return an empty vector if none are provided.
static Indicator const SMA
std::ostream & operator<<(std::ostream &o, Indicator c)
void splitline(const std::string &str, const std::string &delimiters, std::vector< std::string > &tokens)
splitline
std::string const label() const
Get the label.