-
Why did you post your MT4 question in the MT5 Indicators section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread. -
#property indicator_style1 STYLE_DASH ⋮ SetIndexStyle(0,DRAW_LINE,STYLE_DOT);
Style dot in property or use the function call, not both.
-
#property indicator_width1 2
Can't have a width more than one.
-
Why did you post your MT4 question in the MT5 Indicators section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. I have moved this thread. -
Style dot in property or use the function call, not both.
-
Can't have a width more than one.
Sorry for my mistake, thank you for your help.
It worked, but it doesn't work in a different script even though I did as you specified.
//+------------------------------------------------------------------+ //| Trend Ribbon.mq4 | //| Copyright 2023, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2023, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 4 double fastMa[]; double slowMa[]; double up[]; double dn[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexStyle(0,DRAW_LINE,STYLE_DOT,2,clrGreen); SetIndexBuffer(0,fastMa); SetIndexBuffer(1,slowMa); SetIndexStyle(1,DRAW_LINE,STYLE_DOT,2,clrRed); SetIndexBuffer(2,up); SetIndexStyle(2,DRAW_HISTOGRAM,STYLE_SOLID,1,clrGreen); SetIndexBuffer(3,dn); SetIndexStyle(3,DRAW_HISTOGRAM,STYLE_SOLID,1,clrRed); SetIndexEmptyValue(3,0.0); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- int limit = rates_total - prev_calculated; if (prev_calculated>0) limit++; for(int i=limit-1;i>=0;i--) { double fast = iMA(NULL,0,12,0,0,0,i); double slow = iMA(NULL,0,20,0,0,0,i); fastMa[i] = fast; slowMa[i] = slow; if(fast>slow) { up[i] = fast; } else if(fast<slow) { dn[i] = slow; } } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello, I just started learning MQL4 and am doing some small experiments. My request is to draw the line as "Dot" but I couldn't manage to do it. Can you help me with this?