//+------------------------------------------------------------------+ //| Intraday Currencies Performance.mq5 | //| Studio Sofrollo | //| studiosofrollo@gmail.com | //+------------------------------------------------------------------+ //---- author of the indicator #property copyright "Studio Sofrollo" #property link "studiosofrollo@gmail.com" //---- indicator version number #property version "1.00" //---- drawing indicator in a separate window #property indicator_separate_window //----two buffers are used for calculation of drawing of the indicator #property indicator_buffers 22 //---- two plots are used #property indicator_plots 8 //+----------------------------------------------+ //| CG indicator drawing parameters | //+----------------------------------------------+ input int grandezzacarattere=10;// Font size input color Color_USD = Lime; // USD line color input color Color_EUR = Blue; // EUR line color input color Color_GBP = Red; // GBP line color input color Color_CHF = Magenta; // CHF line color input color Color_JPY = Yellow; // JPY line color input color Color_AUD = Aqua; // AUD line color input color Color_CAD = White; // CAD line color input color Color_NZD = Orange; // NZD line color input int wid_main = 1; // Line width input ENUM_LINE_STYLE style_slave = STYLE_SOLID; //Line style int y_pos = 0; // Y coordinate variable for the informatory objects //+----------------------------------------------+ //| Trigger indicator drawing parameters | //+----------------------------------------------+ //+----------------------------------------------+ //| Indicator input parameters | //+----------------------------------------------+ string pair1="EURUSD";//Cross 1 string pair2="GBPUSD";//Cross 2 string pair3="AUDUSD";//Cross 3 string pair4="NZDUSD";//Cross 4 string pair5="USDJPY";//Cross 5 string pair6="USDCAD";//Cross 6 string pair7="USDCHF";//Cross 7 input string tm="00:00";// Time in the format hours:minutes int Shift=0; // horizontal shift of the indicator in bars //+----------------------------------------------+ //---- declaration of dynamic arrays that further //---- will be used as indicator buffers double USD[]; double EUR[]; double GBP[]; double AUD[]; double CAD[]; double JPY[]; double NZD[]; double CHF[]; double OscBuffer1; double OscBuffer2; double OscBuffer3; double OscBuffer4; double OscBuffer5; double OscBuffer6; double OscBuffer7; double open1[]; double close1[]; double open2[]; double close2[]; double open3[]; double close3[]; double open4[]; double close4[]; double open5[]; double close5[]; double open6[]; double close6[]; double open7[]; double close7[]; //---- declaration of the integer variables for the start of data calculation int min_rates_total; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ void OnInit() { //---- Initialization of variables of the start of data calculation min_rates_total=2; //---- set dynamic array as an indicator buffer SetIndexBuffer(0,USD,INDICATOR_DATA); SetIndexBuffer(1,EUR,INDICATOR_DATA); SetIndexBuffer(2,GBP,INDICATOR_DATA); SetIndexBuffer(3,AUD,INDICATOR_DATA); SetIndexBuffer(4,CAD,INDICATOR_DATA); SetIndexBuffer(5,JPY,INDICATOR_DATA); SetIndexBuffer(6,NZD,INDICATOR_DATA); SetIndexBuffer(7,CHF,INDICATOR_DATA); //---- shifting the indicator 1 horizontally by Shift PlotIndexSetInteger(0,PLOT_SHIFT,Shift); PlotIndexSetInteger(1,PLOT_SHIFT,Shift); PlotIndexSetInteger(2,PLOT_SHIFT,Shift); PlotIndexSetInteger(3,PLOT_SHIFT,Shift); PlotIndexSetInteger(4,PLOT_SHIFT,Shift); PlotIndexSetInteger(5,PLOT_SHIFT,Shift); PlotIndexSetInteger(6,PLOT_SHIFT,Shift); PlotIndexSetInteger(7,PLOT_SHIFT,Shift); //---- shifting the start of drawing of the indicator 1 PlotIndexSetInteger(0,PLOT_DRAW_BEGIN,min_rates_total); //---- setting the indicator values that won't be visible on a chart PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE); SetIndexBuffer(8,open1,INDICATOR_CALCULATIONS); SetIndexBuffer(9,close1,INDICATOR_CALCULATIONS); SetIndexBuffer(10,open2,INDICATOR_CALCULATIONS); SetIndexBuffer(11,close2,INDICATOR_CALCULATIONS); SetIndexBuffer(12,open3,INDICATOR_CALCULATIONS); SetIndexBuffer(13,close3,INDICATOR_CALCULATIONS); SetIndexBuffer(14,open4,INDICATOR_CALCULATIONS); SetIndexBuffer(15,close4,INDICATOR_CALCULATIONS); SetIndexBuffer(16,open5,INDICATOR_CALCULATIONS); SetIndexBuffer(17,close5,INDICATOR_CALCULATIONS); SetIndexBuffer(18,open6,INDICATOR_CALCULATIONS); SetIndexBuffer(19,close6,INDICATOR_CALCULATIONS); SetIndexBuffer(20,open7,INDICATOR_CALCULATIONS); SetIndexBuffer(21,close7,INDICATOR_CALCULATIONS); //---- initializations of variable for indicator short name string shortname; StringConcatenate(shortname,"Intr.Curr.%"+" ("+tm+")",""); //--- creation of the name to be displayed in a separate sub-window and in a pop up help IndicatorSetString(INDICATOR_SHORTNAME,shortname); //---- determination of accuracy of displaying the indicator values IndicatorSetInteger(INDICATOR_DIGITS,2); PlotIndexSetString(0,PLOT_LABEL,"% USD"); PlotIndexSetString(1,PLOT_LABEL,"% EUR"); PlotIndexSetString(2,PLOT_LABEL,"% GBP"); PlotIndexSetString(3,PLOT_LABEL,"% AUD"); PlotIndexSetString(4,PLOT_LABEL,"% CAD"); PlotIndexSetString(5,PLOT_LABEL,"% JPY"); PlotIndexSetString(6,PLOT_LABEL,"% NZD"); PlotIndexSetString(7,PLOT_LABEL,"% CHF"); PlotIndexSetInteger(0,PLOT_LINE_COLOR,Color_USD); // color of line rendering PlotIndexSetInteger(1,PLOT_LINE_COLOR,Color_EUR); // color of line rendering PlotIndexSetInteger(2,PLOT_LINE_COLOR,Color_GBP); // color of line rendering PlotIndexSetInteger(3,PLOT_LINE_COLOR,Color_AUD); // color of line rendering PlotIndexSetInteger(4,PLOT_LINE_COLOR,Color_CAD); // color of line rendering PlotIndexSetInteger(5,PLOT_LINE_COLOR,Color_JPY); // color of line rendering PlotIndexSetInteger(6,PLOT_LINE_COLOR,Color_NZD); // color of line rendering PlotIndexSetInteger(7,PLOT_LINE_COLOR,Color_CHF); // color of line rendering PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(1,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(3,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(4,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(5,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(6,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(7,PLOT_DRAW_TYPE,DRAW_LINE); PlotIndexSetInteger(0,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(1,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(2,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(3,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(4,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(5,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(6,PLOT_LINE_WIDTH,wid_main); PlotIndexSetInteger(7,PLOT_LINE_WIDTH,wid_main); perfscrivi(" USD",Color_USD); // rendering in the indicator information window perfscrivi(" EUR",Color_EUR); // rendering in the indicator information window perfscrivi(" GBP",Color_GBP); // rendering in the indicator information window perfscrivi(" AUD",Color_AUD); // rendering in the indicator information window perfscrivi(" CAD",Color_CAD); // rendering in the indicator information window perfscrivi(" JPY",Color_JPY); // rendering in the indicator information window perfscrivi(" NZD",Color_NZD); // rendering in the indicator information window perfscrivi(" CHF",Color_CHF); // rendering in the indicator information window //---- } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // amount of history in bars at the current tick const int prev_calculated,// amount of history in bars at the previous tick const datetime &time[], const double &open[], const double& high[], // price array of maximums of price for the calculation of indicator const double& low[], // price array of price lows for the indicator calculation const double &close[], const long &tick_volume[], const long &volume[], const int &spread[] ) { //---- checking the number of bars to be enough for calculation if(rates_totalrates_total || prev_calculated<=0) // checking for the first start of calculation of an indicator { first=min_rates_total; // starting index for calculation of all bars } else first=prev_calculated-1; // starting number for calculation of new bars CopyOpen(pair1,PERIOD_CURRENT,0,rates_total,open1); CopyClose(pair1,PERIOD_CURRENT,0,rates_total,close1); CopyOpen(pair2,PERIOD_CURRENT,0,rates_total,open2); CopyClose(pair2,PERIOD_CURRENT,0,rates_total,close2); CopyOpen(pair3,PERIOD_CURRENT,0,rates_total,open3); CopyClose(pair3,PERIOD_CURRENT,0,rates_total,close3); CopyOpen(pair4,PERIOD_CURRENT,0,rates_total,open4); CopyClose(pair4,PERIOD_CURRENT,0,rates_total,close4); CopyOpen(pair5,PERIOD_CURRENT,0,rates_total,open5); CopyClose(pair5,PERIOD_CURRENT,0,rates_total,close5); CopyOpen(pair6,PERIOD_CURRENT,0,rates_total,open6); CopyClose(pair6,PERIOD_CURRENT,0,rates_total,close6); CopyOpen(pair7,PERIOD_CURRENT,0,rates_total,open7); CopyClose(pair7,PERIOD_CURRENT,0,rates_total,close7); //---- main cycle of calculation of the indicator for(bar=first; bar