Good Day MQL5 Forum and Programmers.
Please assist I am a beginner in the MT5 programming platform and I have tirelessly trying to write a code that will instruct the sets of indicator line to be inbetween two period seperators.
Please assist I have been trying to go through the OnCalculate function for quite some time.
Please find attached Snips of the code and indicator.
Thank you for your assistance in advance.
1. Please insert the code correctly: when editing a message, use the button to insert the code.
2. Nothing is clear from your drawing.
1. Please insert the code correctly: when editing a message, use the button to insert the code.
2. Nothing is clear from your drawing.
Thank you I have attached the code.
I want the set of colored line to be in between the two period seperators only not for the lines to go all the way to the left.
for example datetime to be in between 2020.04.06 00:00 to 2020.04.07 00:00 only
Thank you I have attached the code.
I want the set of colored line to be in between the two period seperators only not for the lines to go all the way to the left.
for example datetime to be in between 2020.04.06 00:00 to 2020.04.07 00:00 only
In this case, you need to determine the date of the period.
If this is the first launch (prev_calculated == 0)
//--- int limit=prev_calculated- 1 ; if (prev_calculated== 0 ) limit= 0 ;
you put 0.0 in the indicator buffer, before the start of the period date.
In this case, you need to determine the date of the period.
If this is the first launch (prev_calculated == 0)
you put 0.0 in the indicator buffer, before the start of the period date.
its still showing the same thing.
the datetime is already included in the indicator data
Please see attached..on MT4 is like as shown in the picture attached. I need to achieve the same result on MT5its still showing the same thing.
the datetime is already included in the indicator data
Start with the simplest: draw the icon ONLY on the current bar (by the way, I always create file templates using the MQL Wizard)
//+------------------------------------------------------------------+ //| Last Bar.mq5 | //| Copyright 2021, MetaQuotes Ltd. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2021, MetaQuotes Ltd." #property link "https://www.mql5.com" #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 1 //--- plot High #property indicator_label1 "High" #property indicator_type1 DRAW_ARROW #property indicator_color1 clrDeepSkyBlue #property indicator_style1 STYLE_SOLID #property indicator_width1 1 //--- input parameters input int Input1=9; //--- indicator buffers double HighBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,HighBuffer,INDICATOR_DATA); //--- setting a code from the Wingdings charset as the property of PLOT_ARROW PlotIndexSetInteger(0,PLOT_ARROW,159); //--- set as an empty value 0 PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,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=prev_calculated-1; if(prev_calculated==0) { HighBuffer[0]=0.0; limit=1; } for(int i=limit; i<rates_total; i++) { if(i<rates_total-1) HighBuffer[i]=0.0; else HighBuffer[i]=high[i]; } //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
Result:
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good Day MQL5 Forum and Programmers.
Please assist I am a beginner in the MT5 programming platform and I have tirelessly trying to write a code that will instruct the sets of indicator line to be inbetween two period seperators.
Please assist I have been trying to go through the OnCalculate function for quite some time.
Please find attached Snips of the code and indicator.
Thank you for your assistance in advance.