- How to convert Period Current to single Dashboard Chart
- countdown candle
- Timeframe 3m,10m Possible?
- Instead of _Period * 60 you can use PeriodSeconds - Common Functions - MQL4 Reference
- You have to use iTime - Timeseries and Indicators Access - MQL4 Reference not Time.
//+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //EventSetTimer(1); <---Place in OnInt //Clock int thisbarminutes=Period(); double thisbarseconds=thisbarminutes*60; double seconds=thisbarseconds -(TimeCurrent()-Time[0]); // seconds left in bar double minutes= MathFloor(seconds/60); double hours = MathFloor(seconds/3600); minutes = minutes - hours*60; seconds = seconds - minutes*60 - hours*3600; string sText=DoubleToStr(seconds,0); if(StringLen(sText)<2) sText="0"+sText; string mText=DoubleToStr(minutes,0); if(StringLen(mText)<2) mText="0"+mText; string hText=DoubleToStr(hours,0); if(StringLen(hText)<2) hText="0"+hText; ObjectCreate("Time_Remaining",OBJ_LABEL,0,0,0); if(Period()<240) ObjectSetText("Time_Remaining","Time Remaining = "+mText+":"+sText,8,"Ariel",clrDarkGray); else ObjectSetText("Time_Remaining","Time Remaining = "+hText+":"+mText+":"+sText,8,"Ariel",clrDarkGray); ObjectSet("Time_Remaining",OBJPROP_CORNER,1); ObjectSet("Time_Remaining",OBJPROP_XDISTANCE,0); ObjectSet("Time_Remaining",OBJPROP_YDISTANCE,70); ObjectSet("Time_Remaining",OBJPROP_BACK,False); }This is what I use.
Thanks for your replies.
I tried like this.
CandleCountDown = ( PERIOD_M15 * 60 ) - ( TimeCurrent() - Time[0] );
It does not shows correct Countdown.
Best,
Max
This is what I use.
Where may I download that indicator what you use?
Because I tried I cannot make right code what I want.
Best,
Max
Max-Enrik: I tried like this. It does not shows correct Countdown. | Of course it doesn't and I told you how to correct it. (#2) |
Max-Enrik: I tried like this. It does not shows correct Countdown. | Of course it doesn't and I told you how to correct it. (#2) |
Thanks once again @WHRoeder
There is only problem with my English.
I will try it I hope I can do that.
I tried like below but it does not show anything also I have not any error message.
I do not know what is wrong at the there.
datetime CandleCountDown = iTime ( Symbol(), PERIOD_M15, 0); CandleCountDown = ( PERIOD_M15 * 60 ) - ( TimeCurrent() - Time[0] );
I tried like below but it does not show anything also I have not any error message.
I do not know what is wrong at the there.
datetime CandleCountDown = iTime ( Symbol(), PERIOD_M15, 0); CandleCountDown = ( PERIOD_M15 * 60 ) - ( TimeCurrent() - Time[0] );
What do you expect it to do?
You set a value for CandleCountDown, do nothing with that value and then immediately assign another value to the variable
datetime CandleCountDown = iTime ( Symbol(), PERIOD_M15, 0);
gives you the time that the candle opened, you need the time that the candle will close
so add PERIOD_M15*60 to get candle close time
candle close time - TimeCurrent() is the number of seconds remaining until the M15 candle closes
Where may I download that indicator what you use?
Because I tried I cannot make right code what I want.
Best,
Max
The code is a function that i have added to several of my indicators.
I use it on at least 10 different indicators and it works flawlessly.
copy n paste into OnInit()
//EventSetTimer(1); <---Place in OnInt
Thanks for all yours replies.
I will try it soon.
Best,
Max
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use