Future highs in backtesting - page 3

 

I just want to find the future bar numbers, 40 times ahead so I can draw something in the future of the Strategy and I know this is possible but I dunno how to calculate it properly.

Someone said this but not working for me or Im not sure if its correct.

Time[0] + 40 * Period() * 60
 
bonechair: I just want to find the future bar numbers, 40 times ahead so I can draw something in the future of the Strategy and I know this is possible but I dunno how to calculate it properly.
Time[0] + 40 * Period() * 60

You do NOT use bar numbers when creating objects, only time.

That is the time for 40 bars in the future (ignoring the week end and holidays). That IS what you use to create objects.

 
bonechair:

I just want to get this working on something Im working on.

I tried this one to get future time in strategy testing but Im getting zero on iB.

Anybody got a solution with src code please? It cant be that hard can it? I looked everywhere today for simple solution.


“Bonechair”, please see if you can FINALLY GET THE MESSAGE in regards to “FutureBars”:


An EA in the Strategy Tester CANNOT access any future data beyond the current tick using current normal methods. Via “iBarShift” you, WILL NOT BE ABLE TO ACCESS ANY FUTURE DATA. That only works in the Indicator! Is that CLEAR enough for you?


Your only current and plausible solutions are the following:

  1. Access an OFFLINE copy of the History Data as was suggested by “RaptorUK”. This one seems to me the easiest and best one to implement.
  2. Using an indicator, which is able to reference future data on another timeframe, either written by you are using one like “BackToFutue” by “Denis Orlov”. This solution is however, not very consistent and fails sometimes. It also seems that it only works when in Visual mode and not in other testing situations.
  3. Access the History Data directly using the “FileOpenHistory()” as I suggested, but this is the most difficult for your current level of skill.


There may be other solutions, but have yet to be presented, but none will be easy. So, stop mucking about, sayings things like “it cannot be that difficult, can it?”, and just pick one of the possible solutions and do some work on it! Put in the effort!

 

Ok thanks for that answer my friend

I already got a good solution with indicator by getting the values from an indicator and was trying to duplicate just the indicators code into my EA so I dont have to use the indicator and that is

why I kept looking for an answer, it is unhappy to hear that you cant get future bars in EA easily because I want to draw things in future on my EA. Ive looked at fileopenhistory and you are right I dont understand fileseek and have another thread open on this asking about that and how to get the highs and the lows with it.

Is it possible to draw future arrows on EA?

 
bonechair:

Is it possible to draw future arrows on EA?

Yes . .

WHRoeder:

You do NOT use bar numbers when creating objects, only time.

That is the time for 40 bars in the future (ignoring the week end and holidays). That IS what you use to create objects.

 
RaptorUK:

Yes . .




In "bonechair's" defense, he is actually using Time and not Bars as his code demonstrates:

datetime GetTime(int iBar){

  return( Time[0] + iBar * Period() * 60 );

}


The only problem was that he was trying to apply it to "iBarShift()" which we have already explained does not work and he has understood.


However "bonechair", this part of the message is now directed at you, assuming that you are now getting the "future" data by other means and now have the High and Low values you require, now use the Time you acquired from your "GetTime()" function in the "ObjectCreate()" function in order to create/draw those window objects you so desire. But please note that I am only assuming that this will work. I have never tried it myself and do not know if the "ObjectCreate()" function works with future dates. Try it and let us all know.

 
FMIC:



In "bonechair's" defense, he is actually using Time and not Bars as his code demonstrates:

Yes of course and that is exactly what he was being told . . . "That IS what you use to create objects." . . . so he posted the code to do what he wanted and he is still asking how to do it, why ?

Objects can be drawn using times greater than TimeCurrent() the issue is when wanting to set an Object at a certain number of bars in the future, the weekends and holidays are not accounted for. Something placed at TimeCurrent() + (PERIOD_H1 * 6 * 60) on a Friday evening (GMT) before the markets close will end up with a Saturday date when what was intended was 6 H1 bars in the future meaning a Monday date. There is no automatic mechanism within MT4/mql4 to handle this, it is up to the coder to handle it.
 
RaptorUK:
Yes of course and that is exactly what he was being told . . . "That IS what you use to create objects." . . . so he posted the code to do what he wanted and he is still asking how to do it, why ?

Objects can be drawn using times greater than TimeCurrent() the issue is when wanting to set an Object at a certain number of bars in the future, the weekends and holidays are not accounted for. Something placed at TimeCurrent() + (PERIOD_H1 * 6 * 60) on a Friday evening (GMT) before the markets close will end up with a Saturday date when what was intended was 6 H1 bars in the future meaning a Monday date. There is no automatic mechanism within MT4/mql4 to handle this, it is up to the coder to handle it.



Thanks for clarifying. That is useful information. As I stated, I have never used ObjectCreate() in the way the OP intends, so have no idea of the pitfalls and caveats associated with using that way.
Reason: