Backtest Error - page 2

 
RaptorUK:
It will depend on the quality of your data . . as always. If you don't know the quality of that data then you are testing with an unknown quantity . . .

Thanks for reply, Raptor.

I've found out that importing data into MT4 for backtesting is for 2 purposes only. 1) if you wanna go back more than what is already available in MT4 or what it can reach. 2) if your EA trades intra-bar like SL and TP which is not my case at the moment. so I looks like I don't need this altogether. And regarding the quality of the OHLC, I don't think there can be an issue because this data was obtained through live stream when the market was in progress which I would have used it if I had traded live back then.

However, if you have some other thought, you're welcome to share.

tapo

 
tapo:

When performing a backtest on the data which is already downloaded by MT4 through live stream, do we get the most accurate test results?

I know that in order to get 90% modelling quality, there is a procedure of downloading data and copying it to a certain forlder ... etc, but I noticed that when I keep MT4 running with open charts and then perform a backtest on a symbol of one of these open charts and on the period of time that the chart was open, I get n/a as the modelling quality, although the data has been dowloaded live. What do you guys think of the credibility of such a backtest in comparison with that procedure? Do we need to go through that procedure and abandon the data which we get from live stream?

Regards,


Live stream and Scroll-Back Data downloaded from your broker is usually considered most accurate for that broker. Per your picture, you're probably getting NA because you're back-testing in Open-Mode instead of Tick-Mode. I agree with you on the Inter-Bar stuff, but you really have to be careful with what you think is non-interbar EA. Example: you code and test on Open prices but then you proceed to run the EA on Ticks. What happens when you cannot process something on the Bar-Open tick. As far as credibility, it depends...it depends on how the EA was programmed. For the last question, again depends on the quality and need for such quality, don't seem like you have such need, so I don't know why you care :)

 
ubzen:


Live stream and Scroll-Back Data downloaded from your broker is usually considered most accurate for that broker. Per your picture, you're probably getting NA because you're back-testing in Open-Mode instead of Tick-Mode. I agree with you on the Inter-Bar stuff, but you really have to be careful with what you think is non-interbar EA. Example: you code and test on Open prices but then you proceed to run the EA on Ticks. What happens when you cannot process something on the Bar-Open tick. As far as credibility, it depends...it depends on how the EA was programmed. For the last question, again depends on the quality and need for such quality, don't seem like you have such need, so I don't know why you care :)

I like it when someone becomes considerate, so I'll forget about what you said in the other thread :)

I agree with you about "for that broker" thing. In fact this is what I was wondering all the time .. if the spread is so crucial in backtesting how can one rely on data downloaded from other than their own broker?

And you're probably right about "back-testing in Open-Mode instead of Tick-Mode"". I've tried the latter and got 25%, although it is a crappy percentage. In my research I found that tick data are not accurate in live stream and Scroll-Back Data downloaded from your broker! OHLC data is fine though.

You can find a sample of how my EA is programmed here. I am afraid I don't quite understand what you mean by "What happens when you cannot process something on the Bar-Open tick." I mean I don't see how an error in opening a trade can be found our resolved by importing data for backtest. Maybe this is not what you're trying to link. You can explain to me.

Thank you,

tapo

 
tapo:

I like it when someone becomes considerate, so I'll forget about what you said in the other thread :)

I agree with you about "for that broker" thing. In fact this is what I was wondering all the time .. if the spread is so crucial in backtesting how can one rely on data downloaded from other than their own broker?

The data does not include the spread . . . even if you test with data from your own Broker when you start the test the spread used is that which your Broker has for that pair at the start of the test . . if you test at the weekend you may well get a weekend spread 3 or 4 x the usual spread during the week.
 
tapo:

I agree with you about "for that broker" thing. In fact this is what I was wondering all the time .. if the spread is so crucial in backtesting how can one rely on data downloaded from other than their own broker?

You can find a sample of how my EA is programmed here. I am afraid I don't quite understand what you mean by "What happens when you cannot process something on the Bar-Open tick." I mean I don't see how an error in opening a trade can be found our resolved by importing data for backtest. Maybe this is not what you're trying to link. You can explain to me.

Back-Testing assumes static conditions. Real-Life trading makes mistakes. This is true for most simulators ex: BlackJack, Chess, Warfare. Lets use Chess Simulator as example. If the Computer simulate a bunch of Chess moves based on certain Openings, this does Not mean you-the-human can or would have played the game at that level. Back-Testing does not Simulate data-loss, connection-loss, re-quotes... etc.

Yes, it's true Back-tester does not Simulate real-time spreads and mt4-data (live or otherwise) does-not hold spreads. So if you're back-testing with fixed spreads, then it'll be best to select a broker who offers fixed spreads. Otherwise you can try to program conditions which simulates the broker spreads. Example: if (ATR or Standard-Deviation>Small){ i_Spreads=Large; i_Ask=Bid+i_Spread; }. But these are all Estimates and Not an exact science.

But that does-not de-valuate the purpose of Back-testing or Practicing(demo-trading). A blackjack player would not adopt a new system; A chess player would not adopt a new opening and the military would be un-prepared for war without Practicing/Simulating/Back-Testing. It's the share# of independent events which validates the back-test. Example: everyone knows that the odds on a coin flip is 50:50 (heads:tails). If you're a math guy, you could have gotten that answer by equations. If you're a programmer, you can try simulation say about (10000) flips. If you're neither, you can flip coins all day and log the answer. Its the number of flips (independent events) which gives us our answer.

This does not mean you'll always get 50:50 ratio's when you flip coins. If I told you to flip a coin once and get 50% heads and 50% tails, you'd tell me heck no. If I wanted to bet you to get 50% heads and 50% tails on 10 flips (5-heads & 5-tails). You'll again probably tell me no... because you're more likely to lose due to something called Standard-Deviation or Variance or whatever. Same thing with trading systems, you test to get the theoretical numbers like 50:50 in our coin example. But you Cannot Expect that in Real-Life. Reason #1: Real-Life trading makes mistakes, <---replace mistakes with data-loss, connection-loss, re-quotes... etc. Reason#2: it's not static like Chess or Blackjack where all the Cards and Pieces are known as well as all their possible movements. However, If I have to choose between a system with Positive Expectation VS another with Negative Expectation, I'd go with the positive and pray.

Lastly, what I mean by if cannot process something on the Bar-Open tick: Lets say your system gives a Buy-Signal on Open-Tick, you send the order and the broker's server says its-busy (try again in couple sec or mins). How does your EA handle this? Does it go into a While-Loop and Keep asking broker if he's not busy anymore? Does it wait for the next tick (While keeping the Signal Static)? Does it drop the Signal and Re-Calculate on the next tick? All the above handling have an effect on the Simulation-Results vs How it would have performed Live vs what you Intended.

Added: BTW, these are just my personal criterion based on my experiences. Anyone feel free to dis-agree.

 
RaptorUK:
The data does not include the spread . . . even if you test with data from your own Broker when you start the test the spread used is that which your Broker has for that pair at the start of the test . . if you test at the weekend you may well get a weekend spread 3 or 4 x the usual spread during the week.
Do you mean if the last difference between ask and bid prices was 4 pips in E/U when the market closed at 17:00 eastern last Friday, all the backtests that I performed before the market reopened this week were base on this spread?
 
tapo:
Do you mean if the last difference between ask and bid prices was 4 pips in E/U when the market closed at 17:00 eastern last Friday, all the backtests that I performed before the market reopened this week were base on this spread?
Yes . . unless you use a tool to manually set a different spread, or use tick data that has the spread incorporated into it.
 
ubzen:

Back-Testing assumes static conditions. Real-Life trading makes mistakes. This is true for most simulators ex: BlackJack, Chess, Warfare. Lets use Chess Simulator as example. If the Computer simulate a bunch of Chess moves based on certain Openings, this does Not mean you-the-human can or would have played the game at that level. Back-Testing does not Simulate data-loss, connection-loss, re-quotes... etc.

Yes, it's true Back-tester does not Simulate real-time spreads and mt4-data (live or otherwise) does-not hold spreads. So if you're back-testing with fixed spreads, then it'll be best to select a broker who offers fixed spreads. Otherwise you can try to program conditions which simulates the broker spreads. Example: if (ATR or Standard-Deviation>Small){ i_Spreads=Large; i_Ask=Bid+i_Spread; }. But these are all Estimates and Not an exact science.

But that does-not de-valuate the purpose of Back-testing or Practicing(demo-trading). A blackjack player would not adopt a new system; A chess player would not adopt a new opening and the military would be un-prepared for war without Practicing/Simulating/Back-Testing. It's the share# of independent events which validates the back-test. Example: everyone knows that the odds on a coin flip is 50:50 (heads:tails). If you're a math guy, you could have gotten that answer by equations. If you're a programmer, you can try simulation say about (10000) flips. If you're neither, you can flip coins all day and log the answer. Its the number of flips (independent events) which gives us our answer.

This does not mean you'll always get 50:50 ratio's when you flip coins. If I told you to flip a coin once and get 50% heads and 50% tails, you'd tell me heck no. If I wanted to bet you to get 50% heads and 50% tails on 10 flips (5-heads & 5-tails). You'll again probably tell me no... because you're more likely to lose due to something called Standard-Deviation or Variance or whatever. Same thing with trading systems, you test to get the theoretical numbers like 50:50 in our coin example. But you Cannot Expect that in Real-Life. Reason #1: Real-Life trading makes mistakes, <---replace mistakes with data-loss, connection-loss, re-quotes... etc. Reason#2: it's not static like Chess or Blackjack where all the Cards and Pieces are known as well as all their possible movements. However, If I have to choose between a system with Positive Expectation VS another with Negative Expectation, I'd go with the positive and pray.

Lastly, what I mean by if cannot process something on the Bar-Open tick: Lets say your system gives a Buy-Signal on Open-Tick, you send the order and the broker's server says its-busy (try again in couple sec or mins). How does your EA handle this? Does it go into a While-Loop and Keep asking broker if he's not busy anymore? Does it wait for the next tick (While keeping the Signal Static)? Does it drop the Signal and Re-Calculate on the next tick? All the above handling have an effect on the Simulation-Results vs How it would have performed Live vs what you Intended.

Added: BTW, these are just my personal criterion based on my experiences. Anyone feel free to dis-agree.

Thank you very much for the valuable insight.

My code currently says

ticket = OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, 0, 0, "Long", MagicNumber, 0, Green);
if (ticket <= 0) Print("Error opening long order: ", GetLastError());

so if I'm going to check, I'll find out about any order which failed to open. But what would you suggest to make it try again at the next tick holding the signal? If you need to have a look at the code, you can check the EA to which I referred you in my previous post (CCI_MAFilter.mq4). It's simple and I'm sure you'll be able to understand everything in it straight away.

Kind regards,

 
tapo:

I'll find out about any order which failed to open. But what would you suggest to make it try again at the next tick holding the signal?

You need to take different actions depending upon the error . . . see here in the error descriptions: errors
 
tapo:

Thank you very much for the valuable insight.

My code currently says

so if I'm going to check, I'll find out about any order which failed to open. But what would you suggest to make it try again at the next tick holding the signal? If you need to have a look at the code, you can check the EA to which I referred you in my previous post (CCI_MAFilter.mq4). It's simple and I'm sure you'll be able to understand everything in it straight away.

Kind regards,

Glance at this Article. Printing Last_Error is not enough for me. It's what you're gonna do about it which matters. But what would you suggest to make it try again at the next tick holding the signal? Yes, why lose your trade because of error.
Reason: