mar:
Hi coders,
I wanted to create a script which contains user-defined colors. But there is always a compiling error. I think it is not possible to initialize an array with user-defined variables. But how can I solve this problem?
When I initialize the array directly with the colors, there is no problem...
Can anyone help?
You can only initialise an array with constants . . .
Try this instead:
#property show_inputs extern color MN1_col = White; extern color W1_col = Red; extern color D1_col = Yellow; extern color H4_col = Lime; extern color H1_col = Aqua; extern color M30_col = Purple; extern color M15_col = Purple; extern color M5_col = Purple; extern color M1_col = Purple; //+------------------------------------------------------------------+ //| script program start function | //+------------------------------------------------------------------+ int start() { //---- int TF[] = {PERIOD_MN1, PERIOD_W1, PERIOD_D1, PERIOD_H4, PERIOD_H1, PERIOD_M30, PERIOD_M15, PERIOD_M5, PERIOD_M1}; color Colors[9]; Colors[0] = MN1_col; Colors[1] = W1_col; Colors[2] = D1_col; Colors[3] = H4_col; Colors[4] = H1_col; Colors[5] = M30_col; Colors[6] = M15_col; Colors[7] = M5_col; Colors[8] = M1_col;
Thanks, Raptor... It works perfect now!
mar:
Thanks, Raptor... It works perfect now!
Thanks, Raptor... It works perfect now!
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
Hi coders,
I wanted to create a script which contains user-defined colors. But there is always a compiling error. I think it is not possible to initialize an array with user-defined variables. But how can I solve this problem?
When I initialize the array directly with the colors, there is no problem...
Can anyone help?