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?
kentaicm:
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
Documentation on MQL5: Language Basics / Operators / Ternary Operator ?:
- www.mql5.com
, the third operand - "expression3" is performed. The second and third operands, i.e. "expression2" and "expression3" should return values of one type and should not be of void type. The result of the conditional operator execution is the result of expression2 or result of the expression3, depending on the result of expression1. Operator Use...
Carl Schreiber:
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.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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