Ask and Bid in Indicators

 
Hello every body

I experienced the problem that during running an indicator, Bid and Ask are always the last tick and not seperately available for each tick. I tried to handle this problem by running my indicator within an E.A. but the problem steel persists. Can you please advise me how to solve it.

This is important for me because I want to start action exactly when two MAs cross, not after finish of that bar or ....

Many Thanks in advance
 
which one is last tick?
Bid and Ask only is current, no related with ticks.

you can add Print(Bid, " ", Ask);
to your code to find them values.
 

Exactly I mean the same.

Bid and Ask are the current one. And when I Backtest, they are the value of Ask and Bid at the time of tested tick. Those are the values you use for Buy and sell during back testin. Upto now there is no problem.


But if there is an indicator used within your EA, it seems to get Bid and Ask values only from the current price, not from tester. Am I right?

 
current means the time are changing.

when backtest, time are also changing. other are also changing with the time changing.
 
No, in tester indicators get their values from tester. You can see that in visual mode as your indicator may move about with every tick.
First set visual to a very slow speed. This will give you time to add any indiactors you want to the window. Then make it faster and watch.
 
 
It sounds like you are looking for being able to access the Ask/Bid of prior ticks, which as far as I know, is not available, but you would need to maintain your own tick history window. However, that's probably not something to advice, as it in any case will not help you much with the objective to open a trade at exactly the time of an MA crossing. I don't think 'exactness' in that way is not a feature of autotrading, or even manual trading, and it's kind of futile to attempt it.

As you may well know, even if you do figure out that 'now' the crossing occurred, that 'now' is still a time concept relative the time scale of the chart, and not relative any 'absolute reality'. Most trivially, it does not account for, e.g., packet latency on the Internet, which is variable and of the order of some few seconds. So, when the EA discovers the crossing tick, the server may well already have advanced some few more ticks. Also, from the time when the EA acts, by means of an OrderSend, to that taking effect on the server, there is again an unknown lag of possibly several seconds. etc. etc.

Basically, if a solution is sensitive to a small time lag (even up to a minute, I think) between signal actually occurring and action actually taking effect, then it's a quite instable solution for which back-testing says very little or nothing. Possibly, with a back-testing engine that would introduce time lags in a probabilistic manner, you might obtain statistics to claim, say, that "75 runs out of 100 are extremely profitable". Realistically of course, Murphys law would still present one of the other 25 runs when you go live :-)
Reason: