The "Conditions for Selecting Top Strategies" duplicate the build conditions except that the top strategies conditions are evaluated over the entire range of data not including the validation segment, which is separate , rather than just over the build period, as is the case for the build conditions. That will automatically remove any indicators from the build set that are not available for MT4, which will leave the indicators that are available in both platforms. By default, one indicator is used for one currency pair and the timeframe that corresponds to the chart, on which the EA is running. Parameters of Trading Filters AddFilter - ise other neural network indicators as filters for the main signal, generated by the indicator for the current symbol. If anything, there are less details:
July 1st, at 6: Thanks for sharing your research in such a great detail! That was very insightful reading. I now feel inspired to do some more research into NNs and predicting algorithms. It is also nice to see the code shared — not many developers do that. July 2nd, at 2: I try to follow the 4 freedoms of open-source software.
So feel free to download, read, and modify the code. But because it is so avant-garde, it may come with a few quirks. I tried many different things to try to get it to a point where I could use it to profitably predict market trends. But I believe further research is needed. September 15th, at 3: Depends on what kind of increment signs he can predict. Take any currency exchange rate history dataset and take a few subsets from it. Now, perform the following trivial prediction algorithm on those subsets:.
For each increment sign in the subset, predict that it will have the same direction as the previous increment sign. Kuperin et al only tried their algorithm with very few subsets.
Perhaps they did something like the experiment I suggested here, and cherry-picked the sub-sets more likely to produce favorable R-squared and increment sign hit ratios, so that the numbers would look good on paper.
Build options include the population size, number of generations, and options for resetting the population based on "out-of-sample" performance. This value was chosen based on preliminary tests to be a high enough value that it probably would not be reached.
As a result, the build process was repeated every 30 generations until manually stopped. This is a way to let the program identify strategies based on the Top Strategies conditions over an extended period of time. Periodically, the Top Strategies population can be checked and the build process cancelled when suitable strategies are found. Notice that I put "out-of-sample" in quotes. When the "out-of-sample" period is used to reset the population in this manner, the "out-of-sample" period is no longer truly out-of-sample.
Since that period is now being used to guide the build process, it's effectively part of the in-sample period.
That's why it's advisable to set aside a third segment for validation, as was discussed above. After several hours of processing and a number of automatic rebuilds, a suitable strategy was found in the Top Strategies population. Its closed trade equity curve is shown below in Fig. The equity curve demonstrates consistent performance across both data segments with an adequate number of trades and essentially the same results over both data series.
To check the strategy over the validation period, the date controls on the Markets tab see Fig. The results are shown below in Fig. The validation results in the red box demonstrate that the strategy held up on data not used during the build process. The final check is to see how the strategy performed on each data series separately using the code output option for that platform.
This is necessary because, as explained above, there may be differences in the results depending on 1 the code type, and 2 the data series. We need to verify that the chosen settings minimized these differences, as intended. To test the strategy for MetaTrader 4, the data series from TradeStation was deselected on the Markets tab, and the strategy was re-evaluated.
Finally, to test the strategy for TradeStation, the data series from TradeStation was selected and the series for MetaTrader 4 was deselected on the Markets tab, the code output was changed to "TradeStation," and the strategy was re-evaluated. The code for both platforms is provided below in Fig. Click the image to open the code file for the corresponding platform. Examining the code reveals that the rule-based part of the strategy uses different volatility-related conditions for the long and short sides.
The hybrid nature of the strategy can be seen directly in the code statement from the TradeStation code:. The variable "EntCondL" represents the rule-based entry conditions, and "NNOuput" is the output of the neural network.
Both conditions have to be true to place the long entry order. The short entry condition works the same way. Click the figure to open the corresponding code file. It was shown how the strategy code can be generated for multiple platforms by selecting a common subset of the indicators that work the same way in each platform. The settings necessary to generate strategies that reverse from long to short and back were described, and it was demonstrated that the resulting strategy performed positively on a separate, validation segment of data.
It was also verified that the strategy generated similar results with the data and code option for each platform. As discussed above, the stop-and-reverse approach has several drawbacks and may not appeal to everyone. However, an always-in-the-market approach may be more attractive with forex data because the forex markets trade around the clock. As a result, there are no session-opening gaps, and the trading orders are always active and available to reverse the trade when the market changes.
The use of intraday data 4-hour bars provided more bars of data for use in the build process but was otherwise fairly arbitrary in that the always-in-the-market nature of the strategy means that trades are carried overnight.
The build process was allowed to evolve different conditions for entering long and short, resulting in an asymmetric stop-and-reverse strategy. Despite the name, the resulting strategy enters both long and short trades on market orders, although market, stop, and limit orders were all considered by the build process independently for each side. In practice, reversing from long to short would mean selling short twice the number of shares at the market as the strategy was currently long; e.
Likewise, if the current short position was , shares, you would buy , shares at market to reverse from short to long.
A shorter price history was used than would be ideal. Nonetheless, the results were positive on the validation segment, suggesting the strategy was not over-fit. This supports the idea that a neural network can be used in a trading strategy without necessarily over-fitting the strategy to the market. The strategy presented here is not intended for actual trading and was not tested in real-time tracking or trading. As always, any trading strategy you develop should be tested thoroughly in real-time tracking or on separate data to validate the results and to familiarize yourself with the trading characteristics of the strategy prior to live trading.
This article appeared in the February issue of the Adaptrade Software newsletter. If you'd like to be informed of new developments, news, and special offers from Adaptrade Software, please join our email list. The number of lots is calculated by the following formula: UseTrailingStop - the breakeven function, "0" - disabled.
UseChannelOnBars - the number of bars for the channel calculation, price rollback strategy, "0" - disabled. UseMartingaleLot - use of the Martingale strategy, the multiplier by the lot size, "0" - disabled. Parameters of Trading Filters AddFilter - ise other neural network indicators as filters for the main signal, generated by the indicator for the current symbol. SoftFilter - the "false" value: TradeTime - the time period, within which the EA is allowed to open positions.
MaxSpread - the maximum spread value, above which trading is prohibited. Slippage - acceptable slippage. MagicNumber - custom magic number or ID of the order. Optimization To optimize the Expert Advisor, use the following variables: