Time[-1] - page 2

 
That doesn't work... It breaks on M1, M5, M15, etc at the last bar of the trading week.
 
jesuscheung:
That doesn't work... It breaks on M1, M5, M15, etc at the last bar of the trading week.
You know when the trading week ends, you know when it starts, you know how much time passes between the end and the start of the next week . . . compensate in your code.
 
RaptorUK:
You know when the trading week ends, you know when it starts, you know how much time passes between the end and the start of the next week . . . compensate in your code.

Actually, it's going to be hard to compensate. Because Holidays are random - different days and not observed by different brokers in different countries.

Jesus, you're going to have to rethink about WHY you want the value.

 

DxDCn, RaptorUK

Hey good info, thanks for the tip.

That's way easier way of doing that then I have been using.


Jesus,

WHRoeder is right about date calcs and holidays.

Suggest you can look at the code for this https://www.mql5.com/en/code/10459 for an example.


thanks,

dave

 

Still fighting with this problem.

It's realy problem to implement Time[-1] ?

Special if we using croshair we can simple get this data.

There is many cases where we know only bar id in future Time[-n] and it's imposible to reacalculating other elements where is based on bar as standard.. I see here variables from objects grabed by Get as:

ObjectGetShiftByValue( string name, double value)

double price=ObjectGetValueByShift("MyTrendLine#123", 11); //what to type for values as 11 if this exist as [-i ] and it's normal in code?

And we have problems with trendline, tl by angle, gann, cycle.

I have chart in future as simulation/forecasting. Want know when is crosed with trend line and I can return corect time in this complication.

int iBarShift( string symbol, int timeframe, datetime time, bool exact=false)
void SetIndexShift( int index, int shift)


 
reptile: It's realy problem to implement Time[-1] ?

Yes because it's the future. On the M1, if there are no ticks for a minute, there is no next bar. On the D1, the next tick will be 50 hours after the last tick on Friday. You are asking when the next tick will come - unknown It is that simple.

You keep talking about getting future values (TL, gann.) Why do you need future values until the future arrives?

For a trendline you can convert two price/time coordinates to slope/intercept and calculate any price in the future (or bars into the future assuming no missing ones,) but what bar that will be is unknown until that future and if there are missing bars, your trendline is now meaningless.

 

WHRoeder


Well, I still don't understand arguments. If no tick then doji in next bar. Should be normal case and it is - if I have good knoweledge. If exist price thats mind you can trade by current.

If some provider for feed not doing this for stupid M1 than I dont have any words. Matrix! It's other case for ticks in miliseconds. Coz in this exist liqidity perspective. It's hard to imagine no price on M1. Ok, system error. Quotes off. Then doji and volumen = 0. In my opinion is best way and we forgoting for data holes. If some one want sundays, sat. etc weeks just turn on like this with price from previous close bar as doji and vol = 0. This is nothing new. Dukascopy have this and other serious companies.

We "don't need" price in future here. Just stamp for time from bar as Time[0-1], crosshair have this. How they get values?

"I have chart in future as simulation/forecasting. Want know when is crosed with trend line and I can return corect time in this complication."

To continue.. I have MA in future by shifted buffor SetIndexShift. Want know where be crossed with TL. The MA is example - for other example I have other type indicator, are leading etc.. like ECRI or external data. How to get time for cross, TL other obj's and for example to delete pendings?

We trying forecasting in mt4 as platform and we don't have posiblites to do any serious calculation in future.. it's big irony.

I'll try understand if exist some cases where in mt4 internal code is problem that Time[0-n] where n <0, return error. But they using this for example in trend line and working ok. Soo, what is problem to implement this type for Time and other corelated functions like iTime.


The question is dedicated for MetaQuotes as developer.



 

reptile:

If no tick then doji in next bar. Then doji and volumen = 0.

Should be normal case In my opinion

  1. False.
  2. Over the weekend you could not see anything from the previous week. They made a decision 10 years ago and it wasn't yours. Get over it. They're not going to change things for you.
  3. If you want different, do it. "Free-of-Holes" Charts - MQL4 Articles
 

Ok, Roger that. I don't care about problem with holes, weekends etc. And forcasting including this problem and agree for all cases. I know situation about holes and feed very good. It's still time and ocasion to change decision. Smart part code for server and DONE. I doing like 3#.

Ok, I get replay from MQ. There is problem with -1 index for array. So one way is to develop new function

Maybe other soultion for this? NextTime[i] or FutureTime[] or Time[Bars+i] Where Future Bars = all + any bar > Bars

 
datetime GetTime(int iBar){
  if(iBar >= 0) return( Time[iBar] );
  return( Time[0] - iBar * Period() * 60 );
}