Yashar Seyyedin:
Hello everyone.
Suppose a candle is closed and there has been no new tick in the new candle for a few seconds. What will be the result of calling OHLC of shift=0?
Will it return an empty value or the previous candle value?
i think it will return the ohlc of the previous , so no new candle will form , need to test it though with custom ticks
Yashar Seyyedin:
Hello everyone.
Suppose a candle is closed and there has been no new tick in the new candle for a few seconds. What will be the result of calling OHLC of shift=0?
Will it return an empty value or the previous candle value?
there are gaps yeah , it will return the old ohlc . Use this ea to detect them in history for examples:
#property version "1.00" //GREEN DINOSAUR GAP FINDER /* rules : the previous candle marks the date gap bigger than period seconds only between monday and thursday (no weekends) */ int OnInit() { EventSetMillisecondTimer(44); return(INIT_SUCCEEDED); } void OnTimer(){ EventKillTimer(); while(!SymbolIsSynchronized(_Symbol)){ Comment("Admiring the comet in the night sky , please wait..."); ChartRedraw(); Sleep(133); } Print("Loaded"); int barz=iBars(_Symbol,_Period); if(barz>0){ datetime prev_time=0; for(int i=(barz-2);i>=0;i--){ datetime time=iTime(_Symbol,_Period,i); if(prev_time>0){ int distanseconds=(int)((long)time-(long)prev_time); if(distanseconds>PeriodSeconds(_Period)){ ENUM_DAY_OF_WEEK day=dow(prev_time); if(day!=FRIDAY&&day!=SATURDAY&&day!=SUNDAY){ Print("Gap found from "+TimeToString(prev_time,TIME_DATE|TIME_MINUTES|TIME_SECONDS)+" to "+TimeToString(time,TIME_DATE|TIME_MINUTES|TIME_SECONDS)+" "+EnumToString(day)); } } } prev_time=time; } }else{ Print("No bars"); } Print("Trex out"); ExpertRemove(); } void OnDeinit(const int reason){} void OnTick(){} ENUM_DAY_OF_WEEK dow(datetime _time){ MqlDateTime mqt; if(TimeToStruct(_time,mqt)){ return((ENUM_DAY_OF_WEEK)mqt.day_of_week); } return(SATURDAY); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everyone.
Suppose a candle is closed and there has been no new tick in the new candle for a few seconds. What will be the result of calling OHLC of shift=0?
Will it return an empty value or the previous candle value?