roley: I've created the two timeseries, adjusted them togehter, but the indicator show only one of them. What can be the problem?
You have?
SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,X_time_series); SetIndexLabel(0,x); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,Y_time_series); SetIndexLabel(0,y);
whroeder1:
You have?
I've changed the code, but still only one of the two line is coming to the chart
#property copyright "Copyright 2017, Roland Szarka." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Silver #property indicator_color2 Blue //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ extern string y = "EURUSD"; extern string x = "GBPUSD"; int i; MqlRates mqlrates_array_y[]; MqlRates mqlrates_array_x[]; datetime date; int BarShift; double X_time_series[]; double Y_time_series[]; datetime Time_time_series[]; int arraysize_y; int arraysize_x; extern int period=240; void init() { SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,X_time_series); SetIndexLabel(1,x); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,Y_time_series); SetIndexLabel(2,y); } int start() { //--- //------- Adjust the two timeseries -------// arraysize_y=ArrayCopyRates(mqlrates_array_y,y,period); arraysize_x=ArrayCopyRates(mqlrates_array_x,x,period); ArrayResize(X_time_series,MathMin(arraysize_y, arraysize_x)+1); ArrayResize(Y_time_series,MathMin(arraysize_y, arraysize_x)+1); ArrayResize(Time_time_series,MathMin(arraysize_y, arraysize_x)+1); //Print(y," ",arraysize_y," ",x," ",arraysize_x); for(i=MathMin(arraysize_y, arraysize_x)-1; i >= 0; i--) { date=iTime(y,period,i); BarShift=iBarShift(x,period,date); X_time_series[i] = mqlrates_array_x[BarShift].close; Y_time_series[i] = mqlrates_array_y[i].close; Time_time_series[i] = mqlrates_array_y[i].time; } return(0); }
roley: I've changed the code, but still only one of the two line is coming to the chart
You didn't check your return codes so you don't see the problem. You declared the indicator has two buffers, therefor they are numbered 0 and 1.
#property indicator_buffers 2 SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,X_time_series); SetIndexLabel(1,x); SetIndexStyle(2,DRAW_LINE);...
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!
I would like to create an indicator which can show two line of two different currency pair in the same time. I've created the two timeseries, adjusted them togehter, but the indicator show only one of them. What can be the problem?