Indicators with two lines New comment iharter 2013.10.28 03:01 HiI'm trying to create an indicator with two lines.Are moving average.But the graph will show a.The code is: //+------------------------------------------------------------------+ //| Médias Moveis.mq5 | //| Copyright 2013, MetaQuotes Software Corp. | //| http://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "2013, MetaQuotes Software Corp." #property link "http://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 2 #property indicator_plots 1 //---- plotar MA #property indicator_label1 "MA" #property indicator_type1 DRAW_LINE #property indicator_color1 clrRed #property indicator_style1 STYLE_SOLID #property indicator_width1 1 input bool AsSeries=true; input int period=20; //Período input ENUM_MA_METHOD smootMode=MODE_EMA; //Tipo da média movel 1 input ENUM_MA_METHOD smootMode2=MODE_SMA; //Tipo da média movel 2 input ENUM_APPLIED_PRICE price=PRICE_CLOSE; //Preço input int shift=0; double Buffer1[]; double Buffer2[]; int handle1; int handle2; int OnInit() { SetIndexBuffer(0,Buffer1,INDICATOR_DATA); handle1=iMA(Symbol(),0,period,shift,smootMode,price); SetIndexBuffer(1,Buffer2,INDICATOR_DATA); handle2=iMA(Symbol(),0,period,shift,smootMode2,price); return(INIT_SUCCEEDED); } 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 xx=CopyBuffer(handle1,0,0,rates_total,Buffer1); int xxx=CopyBuffer(handle2,0,0,rates_total,Buffer2); return(rates_total); } First indicator Moving Average of ADX Create new window in the toolbox Uwe Goetzke 2013.10.28 05:43 #1 #property indicator_plots 2 #property indicator_label2 "MA2" #property indicator_type2 DRAW_LINE #property indicator_color2 clrBlue #property indicator_style2 STYLE_SOLID #property indicator_width2 1 iharter 2013.10.29 02:00 #2 Thank ugo58.One more doubt. need to create an alert when the two lines intersect averages.As image.Is there any specific function for this? Alain Verleyen 2013.10.29 10:00 #3 iharter: Thank ugo58.One more doubt. need to create an alert when the two lines intersect averages.As image.Is there any specific function for this? No there is not a specific function for that, you have to compare the values of both MA and find when there is a cross. New comment
Hi
I'm trying to create an indicator with two lines.
Are moving average.
But the graph will show a.
The code is: