Discussion of article "Enhancing the StrategyTester to Optimize Indicators Solely on the Example of Flat and Trend Markets"
I am looking at the code.
What does the "RangesRaw = FlatRange>0 ? TrndRange/FlatRange : 0.0; " question mark in the code stands for?
I am looking at the code.
What does the "RangesRaw = FlatRange>0 ? TrndRange/FlatRange : 0.0; " question mark in the code stands for?
x = a>b ? y : z; is simple form of if (a>b) then x=y; else x=z;
See here: https://www.mql5.com/en/docs/basis/operators/ternary
- www.mql5.com
x = a>b ? y : z; is simple form of if (a>b) then x=y; else x=z;
See here: https://www.mql5.com/en/docs/basis/operators/ternary
Thanks for the clarification.
New article Enhancing the StrategyTester to Optimize Indicators Solely on the Example of Flat and Trend Markets has been published:
To detect whether a market is flat or not is essential for many strategies. Using the wellknown ADX we demonstrate how we can use the Strategy Tester not only to optimize this indicator for our specific purpose but we as well can decide whether this indicator will meet our needs and we will get to know the average range of the flat and the trend markets which might be quite important to determine stops and targets of the markets.
The Idea
We build a pseudo-EA that does not trade! It has only three important functions. OnTick(), where we check the indicator and determine the market state, OnTester() where we write the final result to our csv-file and calcOptVal() where we calculate the value OptVal which is returned by OnTester() to the Strategy Tester for the ordering and the Genetic Algorithm. Its OnTester() function which is called at the and of an optimization pass returns a specific value and it adds a new line to a csv-file for an analysis after the whole optimization has finished.
Now our pseudo-EA is ready and we prepare the Strategy Tester for the Optimization:
After 25 minutes on my laptop from 2007 the Strategy Tester has completed the optimization and we find the resulting csv-file in ..\tester\files\.
In the Optimizations Graph we can see for example (bottom =LIM, right=PER):
Author: Carl Schreiber