What does it need to do ?
It needs to do when Period will be 'M30' and above indicator would be exit.
{
if ( Period() >= PERIOD_M30 )
{
ChartIndicatorDelete();
}
}
long chart_id, // chart id
int sub_window // number of the subwindow
const string indicator_shortname // short name of the indicator
);
Please see:
https://www.mql5.com/en/docs/chart_operations/chartindicatordelete
- www.mql5.com
Wow! Much appreciate!
And thanks for the much clearly comment.
That is which one remove indicator, indicator won't be back even I return back to 'M15'. Period. (Just I tried it.)
(I will use it in my future indicator.)
---
So, I will use my code which one I mentioned above in my indicator for when Period will be 'M30' and above - all specified 'OBJ_VLINE' will be delete, when I will return Period under 'M30' specified 'OBJ_VLINE' will be appear in my chart. Just I want to ask is that code good for that or what?
Thanks!
I can ignore clock '00:00' with below code.
But I need to ignore first hour (it's possible Hour 01:00 or 02:00 and so on) of day.
Please someone help me, I am working for it (for myself).
Thanks.
switch (hour)
{
case 0:
// do something between 0 and 1 hr
break;
case 1:
// do something between 1 and 2 hr
break;
case 2:
// do something between 2 and 3 hr
break;
case 3:
// do something between 3 and 4 hr
break;
case 4:
// do something between 4 and 5 hr
break;
case 5:
// do something between 5 and 6 hr
break;
// and etc. onto 23 hr
}
Can use switch operator.
Please see:
- www.mql5.com
switch (hour)
{
case 0:
// do something between 0 and 1 hr
break;
// and etc. onto 23 hr
}
Can use switch operator.
What a brilliant and much clearly answer, huge thanks.
It helped me a lot. (I try it...)
so I try just for counts from First Bar of Currently Day and to future Period H1 (with below code)
int _cnt = MathMin( Bars, _mmin );
for ( int i = 0; i < _cnt; i++ ) {}
Example:
EURUSD have 23 Hours in a day. (Which one above code works for EURUSD)
FB have 06 Hours in a day. (Above code does not work for FB)
So, I try to get '23 for EURUSD' and '6 for FB' I hope you understand me.
All the best.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
#'Period H1' - Issue Open
I has been put below code in my indicator, but I am not sure below code is good or what?
So please Pro Coders let me know about it.
{
if ( Period() >= PERIOD_M30 ) return(0); // this code at the top
}
Thanks.