Seeking Wisdom

 
 

I remember something similar happening, which looked like the indicator used by the EA actually is invoked *after* the EA for a tick. Possibly different at the first invocation, since the EA triggers the loading of the indicator and an associated invocation, but subsequently, I got the impression that first the EA start method was invoked, and it poked into the indicator as it were, then when the EA has returned, the indicator start method is invoked.

This was a fair while ago, and possibly pre 201, but it definitely was my impression at the time. Of course, there where so many new things at that time, and I may well have made up the explanation to avoid admitting to a bug of my own.

 

Thanks

Hello Ralph,

THanks for taking the time to read and answer my post. After thinking about this over night I have come to the conclusion that it is most likely with my code.

My plan of attack it to test this out with a single default indicator supplied with MT and then test it out with each or my indicators one by one.

If all of that passes then it must be that my mega indicator is calling to many other inidcators and the timing is getting messed up.

In the past I have been very critical of Metaquotes and I still think they have many issues but I also now think that 90% of most of the problems that people have with MT can be linked to not understanding the Nuances of MT and/or bad code.

Thank you

EK

 

Hmm...

Hello Ralph,

Well the same thing happens when I use a MT supplied indicator. So it must be the backtester not starting/using the same data or some other timing disconnect.

Since currently I am unable to see what is going on with live data and in real time. I would like to ask you did the same problem occur when you tested on live data not in the backtester?

Thank you for your Time

EK

 

I just made a small test, with an EA using an indicator, and with "Print" statements as the very first thing in each start function. From that it looks like the indicator is called exactly the first time the EA asks for its buffer value. I.e., it appears to behave exactly how I would want it to appear.

I haven't tried it recursively, with indicators using indicators, but I would have some confidence that it then does work in the "natural" way.

I tested this on the incoming data stream; not "live" but a demo account.

One mistake I keep re-making is to take into account that the bar 0 value(s) of an indicator typically changes for every new tick, until the closing tick, after which that data shifts to be bar 1 value(s). So, when does your indicator write to file? which timestamp is used?

 

Yes the Zero is it

Hello Ralph,

Thank you for pointing out to me that I should be using 1 not zero.

I am trying to automate my indicator into an EA and thats when I noticed the strange values for each bar.

Currently my Indicator tracks trades but it does so at the close and not at the open.

Thanks for your Help

EK

Files:
ind.jpg  642 kb
Reason: