I had this idea and it seems awesome to me but it is tricky to execute:
Instead of optimizing EA parameters, I want the EA to automatically backtest the specific parameter values generated by the live market at execution time.
Then if all the stats (profit factor, number of trades, drawdown, etc) are satisfactory (determined by a pre-programmed criteria), the EA would proceed with the trade.
The problem of course is the automated backtest itself. It is very tricky (although not impossible) to backtest the situation by having the EA open a new metatrader window through user32.dll. This would be the ideal solution, but it is a tough programming job (at least for me).
A much easier solution would be to perform a crude backtest directly in the EA itself without invoking the MT4 backtest engine.
However, because my EA has no pre-set stop loss or take profits (it determines order operations dynamically), it is hard to determine how profitable (or unprofitable) a trade would have been.
I tried simply checking the price a few hours after the order's open time, but I found no correlation between that and profitability.
I also tried using MA instead of price. I even pre-determined the average order exposure time to use an approximately accurate shift, but I still could not get the correlation value to be sufficiently high.
Does anyone have any tips for me? If not then I guess I will start on my long hard road with the windows API....
Instead of optimizing EA parameters, I want the EA to automatically backtest the specific parameter values generated by the live market at execution time.
Then if all the stats (profit factor, number of trades, drawdown, etc) are satisfactory (determined by a pre-programmed criteria), the EA would proceed with the trade.
The problem of course is the automated backtest itself. It is very tricky (although not impossible) to backtest the situation by having the EA open a new metatrader window through user32.dll. This would be the ideal solution, but it is a tough programming job (at least for me).
A much easier solution would be to perform a crude backtest directly in the EA itself without invoking the MT4 backtest engine.
However, because my EA has no pre-set stop loss or take profits (it determines order operations dynamically), it is hard to determine how profitable (or unprofitable) a trade would have been.
I tried simply checking the price a few hours after the order's open time, but I found no correlation between that and profitability.
I also tried using MA instead of price. I even pre-determined the average order exposure time to use an approximately accurate shift, but I still could not get the correlation value to be sufficiently high.
Does anyone have any tips for me? If not then I guess I will start on my long hard road with the windows API....