Declare the properties globally and not in OnInit().
#property indicator_buffers 2 #property indicator_color1 Blue #property indicator_style1 STYLE_DOT #property indicator_width1 1 #property indicator_color2 Red #property indicator_style1 STYLE_DOT #property indicator_width2 1 extern int MA_Period=50; int Limit; int Bar; int i; int j; int It; int Count; double HoP[]; // High of period double LoP[]; // Low of period double SoH; // Sum of highs double SoL; // Sum of lows double Top_Band[]; double Bottom_Band[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(0,Top_Band); SetIndexBuffer(1,Bottom_Band); //SetIndexStyle(0,0,2,1); //SetIndexStyle(1,0,2,1); SetIndexLabel(0,"Top Band"); SetIndexLabel(1,"Bottom Band"); return(INIT_SUCCEEDED); }
Thank you.
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 display two versions of a custom indicator (with differing lookback periods), on the same chart, but when I try to change the indicator width or line style in the indicator properties box, it just disapears off of the chart after pressing "OK".
What do I need to enable to allow the properties box to change colours/line style/line width?
Code is below just in case: