trading intra-candle on Open Prices

 

Hi


AFAIK it's not possible to open a trade withing the candle duration on Open Prices.

other systems allow that. it's just a matter of checking if the price asked for entry is within high and low of the bar, then computing the Drawdown as if price went the opoosite way and came back (worst case scenario)

If have some strategies that enter one trade during the life of the candle (for example at the high of previous candle), and if I want to backtest at the speed of Open Prices, I have to create custom samples and it's quickly a pain when it would be really simple to allow an entry price during candle time.

do you think it's something Metaquotes could implement in the next version of MT5? 

thanks

Jeff

Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
Documentation on MQL5: Constants, Enumerations and Structures / Indicator Constants / Price Constants
  • www.mql5.com
Price Constants - Indicator Constants - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Jean Francois Le Bas: AFAIK it's not possible to open a trade withing the candle duration on Open Prices.

That makes no sense. There is only one open price in a candle.

 
William Roeder #:

That makes no sense. There is only one open price in a candle.

yes there is only one open price in a candle but you can "open" a trade within high and low and be 100% sure that price crossed that level within the life of the candle

so you can trade that way on "open prices". Some other platforms allow that

let's say for example you want to open a trade on the breakout of the High of previous candle. You can only do that on a tick based backtest, which is very slow.

but you could very well simply verify that the High of the previous candle is within the High and Low of the actual candle and use that price to open a trade. simple and effective and you don't need to know "when" it was opened if you don"t close on the same bar, before the close

 
Jean Francois Le Bas #: let's say for example you want to open a trade on the breakout of the High of previous candle. You can only do that on a tick based backtest, which is very slow.
It is not slow, your code is.
  1. EAs : Don't do per tick what you can do per bar, or on open.
    If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
    If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
              How to get backtesting faster ? - MT4 - MQL4 programming forum (2017)

  2. Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
              How to do your lookbacks correctly. (2016)
    Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)

 
William Roeder #:
It is not slow, your code is.
  1. EAs : Don't do per tick what you can do per bar, or on open.
    If you are waiting for a level, don't reevaluate, wait until price reaches it (or a new bar starts, and you recalculate.)
    If you are waiting for an order to close, only look when OrdersTotal (or MT5 equivalent) has changed.
              How to get backtesting faster ? - MT4 - MQL4 programming forum (2017)

  2. Indicators: Code it properly so it only recomputes bar zero (after the initial run.)
              How to do your lookbacks correctly. (2016)
    Or, reduce Tools → Options (control+O) → Charts → Max bars in chart to something reasonable (like 1K.)

yeah thanks my code is optimized ok, but I do a lot of stuff in the background and my money management is complicated. Maybe i'm overcomplicating things, but MT5 is a wonderful tool so it's prone to experimentation

anyway I tried loading 10 years of tick data on 28 forex pairs and I could not do it (not enough memory) and my PC is recent

ticks data backtest will always be slower. I don't want to wait 20 hours when I can wait 1 minute doing an open price backtest.

saying "you are the problem not the engine" is a lousy way to discredit oneself.


by using Custom Symbols and stocking only the necessary ticks, I can make a backtest on 10 years 28 pairs in a few seconds, a  few minutes tops. I think this beats any tick data backtest don't you think...

But Custom Symbol backtests are way more complicated and you cannot change indi parameters afterwards...But to work on the money management alone this is gold, because of the speed of the backtests. So it has pros and cons


by the way i'm not a beginner and I follow every rule you posted already. It's just that tick data backtests will ALWAYS be WAY slower than Open Price

and I like speed

think about it. Do you really want to spend years backtesting an EA, doing tweaks here and there when you could do it 100x times faster ? in one WEEK instead of one YEAR ?

EDIT : I meant "stocking only necessary TICKS"
 
Jean Francois Le Bas #:

yeah thanks my code is optimized ok, but I do a lot of stuff in the background and my money management is complicated. Maybe i'm overcomplicating things, but MT5 is a wonderful tool so it's prone to experimentation

anyway I tried loading 10 years of tick data on 28 forex pairs and I could not do it (not enough memory) and my PC is recent

ticks data backtest will always be slower. I don't want to wait 20 hours when I can wait 1 minute doing an open price backtest.

saying "you are the problem not the engine" is a lousy way to discredit oneself.


by using Custom Symbols and stocking only the necessary ticks, I can make a backtest on 10 years 28 pairs in a few seconds, a  few minutes tops. I think this beats any tick data backtest don't you think...

But Custom Symbol backtests are way more complicated and you cannot change indi parameters afterwards...But to work on the money management alone this is gold, because of the speed of the backtests. So it has pros and cons


by the way i'm not a beginner and I follow every rule you posted already. It's just that tick data backtests will ALWAYS be WAY slower than Open Price

and I like speed

think about it. Do you really want to spend years backtesting an EA, doing tweaks here and there when you could do it 100x times faster ? in one WEEK instead of one YEAR ?

EDIT : I meant "stocking only necessary TICKS"
And how do you know the "necessary ticks" by advance ?
Reason: