Arad016: its functioning as intended as you can see there are total of 6 lines , 3 above and 3 below the candle
the only problem remaining now is the time issue
Just because it seems like it is working correctly does not mean that it is properly coded in order to build on more functionality on top of it. Show some pride in your work and first correct the issues identified.
Fernando Carreiro: Just because it seems like it is working correctly does not mean that it is properly coded in order to build on more functionality on top of it. Show some pride in your work and first correct the issues identified.
yes you are right about that i was planning to correct it after the time issue is resolved because once every thing is working then i can focus on formatting the code correctly
anyways here is the recent copy of the code along with the comments
//+------------------------------------------------------------------+//| Indicator: a.mq4 |//| Created by Arad Sanders |//+------------------------------------------------------------------+#property copyright"Created by Arad Sanders"#property version"1.00"#property description"open for modifications"#include <stdlib.mqh>
#include <stderror.mqh>
//--- indicator settings#property indicator_chart_window#property indicator_buffers6#property indicator_type1DRAW_LINE#property indicator_style1STYLE_SOLID#property indicator_width11#property indicator_color10xFFAA00#property indicator_label1"Buy"#property indicator_type2DRAW_LINE#property indicator_style2STYLE_SOLID#property indicator_width21#property indicator_color20x0000FF#property indicator_label2"Sell"#property indicator_type3DRAW_LINE#property indicator_style3STYLE_SOLID#property indicator_width31#property indicator_color30x00FF0D#property indicator_label3"Buy"#property indicator_type4DRAW_LINE#property indicator_style4STYLE_SOLID#property indicator_width41#property indicator_color40xD900FF#property indicator_label4"Sell"#property indicator_type5DRAW_LINE#property indicator_style5STYLE_SOLID#property indicator_width51#property indicator_color50x00F2FF#property indicator_label5"Buy"#property indicator_type6DRAW_LINE#property indicator_style6STYLE_SOLID#property indicator_width61#property indicator_color60xFF00A6#property indicator_label6"Sell"//--- indicator buffersdouble Buffer1[];
double Buffer2[];
double Buffer3[];
double Buffer4[];
double Buffer5[];
double Buffer6[];
externdouble DEM_Values = 0.3;
double myPoint; //initialized in OnInitvoid myAlert(string type, string message)
{
if(type == "print")
Print(message);
elseif(type == "error")
{
Print(type+" | a @ "+Symbol()+","+Period()+" | "+message);
}
elseif(type == "order")
{
}
elseif(type == "modify")
{
}
}
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+intOnInit()
{
IndicatorBuffers(6);
SetIndexBuffer(0, Buffer1);
SetIndexEmptyValue(0, 0);
SetIndexBuffer(1, Buffer2);
SetIndexEmptyValue(1, 0);
SetIndexBuffer(2, Buffer3);
SetIndexEmptyValue(2, 0);
SetIndexBuffer(3, Buffer4);
SetIndexEmptyValue(3, 0);
SetIndexBuffer(4, Buffer5);
SetIndexEmptyValue(4, 0);
SetIndexBuffer(5, Buffer6);
SetIndexEmptyValue(5, 0);
//initialize myPoint
myPoint = Point();
if(Digits() == 5 || Digits() == 3)
{
myPoint *= 10;
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+intOnCalculate(constint rates_total,
constint prev_calculated,
constdatetime& time[],
constdouble& open[],
constdouble& high[],
constdouble& low[],
constdouble& close[],
constlong& tick_volume[],
constlong& volume[],
constint& spread[])
{
int limit = rates_total - prev_calculated;
//--- counting from 0 to rates_totalArraySetAsSeries(Buffer1, true);
ArraySetAsSeries(Buffer2, true);
ArraySetAsSeries(Buffer3, true);
ArraySetAsSeries(Buffer4, true);
ArraySetAsSeries(Buffer5, true);
ArraySetAsSeries(Buffer6, true);
//--- initial zeroif(prev_calculated < 1)
{
ArrayInitialize(Buffer1, 0);
ArrayInitialize(Buffer2, 0);
ArrayInitialize(Buffer3, 0);
ArrayInitialize(Buffer4, 0);
ArrayInitialize(Buffer5, 0);
ArrayInitialize(Buffer6, 0);
}
else
limit++;
//--- main loopfor(int i = limit-1; i >= 0; i--)
{
if (i >= MathMin(5000-1, rates_total-1-50)) continue; //omit some old rates to prevent "Array out of range" or slow calculation //Indicator Buffer 1if(true//no conditions!
)
{
Buffer1[i] = Open[i] + 10 * myPoint; //Set indicator value at Candlestick Open + fixed value
}
else
{
Buffer1[i] = 0;
}
//Indicator Buffer 2if(true//no conditions!
)
{
Buffer2[i] = Open[i] - 10 * myPoint; //Set indicator value at Candlestick Open - fixed value
}
else
{
Buffer2[i] = 0;
}
//Indicator Buffer 3if(true//no conditions!
)
{
Buffer3[i] = Open[i] + 20 * myPoint; //Set indicator value at Candlestick Open + fixed value
}
else
{
Buffer3[i] = 0;
}
//Indicator Buffer 4if(true//no conditions!
)
{
Buffer4[i] = Open[i] - 20 * myPoint; //Set indicator value at Candlestick Open - fixed value
}
else
{
Buffer4[i] = 0;
}
//Indicator Buffer 5if(true//no conditions!
)
{
Buffer5[i] = Open[i] + 25 * myPoint; //Set indicator value at Candlestick Open + fixed value
}
else
{
Buffer5[i] = 0;
}
//Indicator Buffer 6if(true//no conditions!
)
{
Buffer6[i] = Open[i] - 25 * myPoint; //Set indicator value at Candlestick Open - fixed value
}
else
{
Buffer6[i] = 0;
}
}
return(rates_total);
}
//+------------------------------------------------------------------+
yes you are right about that i was planning to correct it after the time issue is resolved because once every thing is working then i can focus on formatting the code correctly
anyways here is the recent copy of the code along with the comments
You have not changed anything in your code and you have not corrected any of the points that I mentioned. Well, if you are not willing to put in the effort, then I am not going to bother explaining my answer. I will just provide a quick answer and leave it up to you to figure it out.
// Code is untested and serves only as an exampleint OpenHour = ( time[ i ] / 3600 ) % 24;
if( ( OpenHour >= StartHour ) && ( OpenHour < StopHour ) )
{
// Do something ...
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Please see: https://docs.mql4.com/dateandtime/timehour
the only problem remaining now is the time issue
Just because it seems like it is working correctly does not mean that it is properly coded in order to build on more functionality on top of it. Show some pride in your work and first correct the issues identified.
yes you are right about that
i was planning to correct it after the time issue is resolved
because once every thing is working then i can focus on formatting the code correctly
anyways here is the recent copy of the code along with the comments
yes you are right about that
i was planning to correct it after the time issue is resolved
because once every thing is working then i can focus on formatting the code correctly
anyways here is the recent copy of the code along with the comments
You have not changed anything in your code and you have not corrected any of the points that I mentioned. Well, if you are not willing to put in the effort, then I am not going to bother explaining my answer. I will just provide a quick answer and leave it up to you to figure it out.