1minute OHLC vs every tick - opposite results - page 2

 
laplacianlab:

I absolutely agree with ugo58. Big bars can trigger the event OnTick many times, while small bars will trigger it much fewer.

This can have an impact on your automated trading strategy, so we developers have to look for solutions that mitigate the fact that your event OnTick may be executed many many times per bar.

I think that what I sent before is just one solution. ugo50 proposed another solution: running your OnTick logic in the most recent past bar. Anyway, if you want to run your OnTick logic on the current bar maybe you can use something similar to what I sent before.

We are trying to implement something like a OnBar event.

What do you think about this?

laplacianlab:
Maybe this link is also useful, https://www.mql5.com/en/articles/159

The code you posted is fondamentaly the same as that of the article. This isn't something new and it's the best approach for an EA which trades on closed bars.

Although not directly related to this topic, this article would probably be interesting for you.

 
michelino:

I'm getting complete opposite result when testing on every tick or 1min OHLC. the EA and input parameters are exactly the same but in the case of 1min ohlc I get 50000 profit while in every tick I get -7000 losses.

this happens on many pairs testing on a period of 2 years 0811-0813

someone have had the same problem? I don't understand what is the problem here and what shall I do when trading real money. 

 both graph below

1minute OHLC

every tick

 

 

 

hi, number of trade must be very different too, is it ? if you select every tick it means your onTick function is executed something like every x seconds. Same for me bad results.

2013.08.21 08:54:04    Core 1    EURUSD.e,M3: 72488 ticks (6230 bars) 



 
Florew:

hi, number of trade must be very different too, is it ? if you select every tick it means your onTick function is executed something like every x seconds. Same for me bad results.



I try to explain my way.

The price movement is like a seismograph. Observed at its smallest scale, it is halfway between chaos and unpredictability, but as we increase the scale of our observations the price becomes more and more deterministic. Anyway, we must always keep in mind that the price bars are merely arbitrary discretizations of the price movement. 

This would be the theoretical explanation. What do you think of this? You can refute if you want. 

 
michelino:

someone have had the same problem? I don't understand what is the problem here and what shall I do when trading real money. 


Excuse my insistence on the participation of this thread, am just trying to help. It turns out that now I'm involved in a strategy where this issue is very important.

In short, if the path that the price movement defines through the bars is very important for your strategy, then MQL5's OnTick mode is essential. On the other hand, if your trading strategy moves in a larger scale, so to speak, OnTick mode may be not necessary. In this case you don't need to waste your computer's resources to test your strategy. You should read this https://www.mql5.com/en/docs/runtime/testing

That said, it would be interesting to analyze your trading strategy to discover what's happening. What builds your system? In which idea is it based? How did you build it?..

It seems that the fundamental parts of your system are strongly based on the short term (very short time frames, minute bars), in a scale for which one minute makes a big difference. You should analyze those parts.

Regards! 

Documentation on MQL5: MQL5 programs / Testing Trading Strategies
Documentation on MQL5: MQL5 programs / Testing Trading Strategies
  • www.mql5.com
MQL5 programs / Testing Trading Strategies - Documentation on MQL5
 
laplacianlab:

I try to explain my way.

The price movement is like a seismograph. Observed at its smallest scale, it is halfway between chaos and unpredictability, but as we increase the scale of our observations the price becomes more and more deterministic. Anyway, we must always keep in mind that the price bars are merely arbitrary discretizations of the price movement. 

This would be the theoretical explanation. What do you think of this? You can refute if you want. 


Not expert on candle formation process but your explanation seems correct from my point of view.

My understanding is that simulation of EA set with every tick option (not 1min OHLC) behave more or less as in real market condition. Well, except if the EA has some code saying to wait for the complet formation of the 1 min. OHLC candle, as I understood you mentione here. Not sure it is the meaning of the code, m'I correct ? : ) 


 *** EDIT ***


For you guys what precaution must be taken for an EA in real market condition (demo or true) behaves likes with the 1min. OLHC simulation option (the most profitable) ?

 
Florew:


For you guys what precaution must be taken for an EA in real market condition (demo or true) behaves likes with the 1min. OLHC simulation option (the most profitable) ?

Perhaps you should ask yourself which simulation is the correct one ?  and why ?  and then can you reproduce that simulated data in live trading ?
 
RaptorUK:
Perhaps you should ask yourself which simulation is the correct one ?  and why ?  and then can you reproduce that simulated data in live trading ?


I agree with u. I got answer to the first and 2nd question but not last.

In this article isn't an error on number of support points for this first example ? I can see only one support point for both opening shadow and closing shadow. It is said three :/


If the shadow is generated using three support points and integer values 3 / 4 the size of the shadow and 1 / 2 the size of the shadow are equal (this happens when the difference between Open and Low or Open and High is not greater than 2 points), then the generation of the shadow changes in the following way:
 

If the shadow is generated by two support points, then the control points are arranged in the following way:

 
Florew:

hi, number of trade must be very different too, is it ? if you select every tick it means your onTick function is executed something like every x seconds. Same for me bad results.



not really number of trades differs slightly 5-10%. but I understood why this happens since the EA enters the market long when price is below the moving average a certain amount of points (the oppostie for short position) when trading ohlc it buys exactly on the low while on every tick it buys between low and close so it takes a lot of profit that normally wouldn't.

so there's no way to reproduce this performance unfortunately 

 
Florew:


In this article isn't an error on number of support points for this first example ? I can see only one support point for both opening shadow and closing shadow. It is said three :/


I think there's some mismatch between concepts and terminology. Where do you see the only support point in the figures you send?

Anyway, I also think that the details of that algorithm are too much for us in the sense that it doesn't matter how the historical tick sequence is built. It is very good and interesting accessing that information but I mean that we are doing nothing with that! We only can be aware of the pitfalls of computers when handling discrete things. There is always some point where you lose some accuracy, it is the same thing for floating point values. The difference here is that we are also dealing with human behavior at a very small scale..

By the way we have also discussed the fact that brokerage's historical data are not the same, and that this difference becomes bigger in the short time. 

What do you think about all this? Is that correct? Do you think it is worthy focusing on strategies that should work well in the tiny run? 

 

michelino:

so there's no way to reproduce this performance unfortunately 


Not sure to understand your point. In my opinion it must be possible to reproduce le 1 minute OHLC mode simulation.

Documentation says : 

In the "1 minute OHLC" mode, the tick sequence is constructed only by the OHLC prices of the minute bars, the number of the generated control points is significantly reduced - hence, so is the testing time. The launch of the OnTick () function is performed on all control points, which are constructed by the prices of OHLC minute bars.

Then :

To test the trading strategy, we need a sequence of ticks, on which the work of the Expert Advisor will be simulated. Thus, for every minute bar, we know the 4 control points, where the price has definitely been. If a bar has only 4 ticks, then this is enough information to perform a testing, but usually the tick volume is greater than 4.

Question is : how many control points in OHLC minute bars and how to modify the onTick() function to work on each of them ?

According to the text in both quotations I understand the response for the first question is always 4, because if a bar has more than 4 ticks it is "significantly" reduce to speed up testing time.  For next question, the thing is to identify the 4 controls points of the 1 minute OHLC bars in real market condition, then ask onTick() to work on them.