I came across a thread that grew my interest in self optimization, so I took a crack at creating a discretionary self optimized indicator. This a rough version of my first attempt, and am looking for help in making it more efficient and useful.
This indicator tries to optimize four different HMA's using the expected profit of trades taken when MA crosses happen given different "market phases" based on stochastics of a minute based dataseries.
I began with defining six different "market phases" based on Stochs. The stochastic values are generated from a selectable minute data series(I would like to make it based on BetterRenko data series, but don't know how). The six phases are:
OBR- Overbought Rising. Above 80 and still increasing.
OBF- Overbough Falling. Above 80 and not increasing.
R- Rising. Between 20 and 80 and increasing.
F- Falling. Between 20 and 80 and not increasing.
OSR- Oversold Rising. Below 20 and increasing
OSF- Oversold Falling. Below 20 and not increasing
I then added four Fast MA's and four Slow MA's and track all trades based on MA crosses. I added 1 tick slippage for entries and exits, and then gather and categorize all the data from the trades based on the MarketPhase during the entry. The results is internally tracking 192 different types of trades (4 fast * 4 slow * 6 phases * 2 types of trades[Long and Short])
Four variable MA's are plotted based on the highest expected profit(Total Profit/Total Trades) for the current market phase. If there is a positive expected profit, the MA's for your long signals will be green(fast) and Lime(slow), and the MA's for your short signals will be red(fast) and Fuchsia(slow). If the highest expect profit is negative, the MA's will be colored gray and dark gray. Since the MA's can be the same for short and long, I recommend making one or the other dashed to differentiate.
I would like some help if anyone is interested in displaying the current market phase expected profits, total profit, and percent profitable for each of the 32 entry signals in a table directly on the chart. My goal would be to highlight the rows for the current signal with the highest expected profit, and highlight the cells when any other cross happens:
Current Market Phase - Title Bar
Columns:
Signal;Expected Long Profit;Total Long Profit; Percent Profitable Long;Expected Short Profit; Total Short Profit; Percent Profitable Short
Rows:
1-1;1-2;1-3;1-4;2-1;2-2;2-3;2-4;3-1;3-2;3-3;3-4;4-1;4-2;4-3;4-2
This information is already stored in arrays inside the indicator. All arrays are structures so that [0] == fast1;slow1, [1]==fast1;slow2....[15]==fast4;slow[4]
Right now the stochs are based on selectable minute periods, but I would like to make it based on BetterRenko bars to filter out some of the noise.
There is so much information stored and passed in this, that I would like someone else to get a set of eyes on it to see if I have skewed logic, or mistakes anywhere. If anyone is interested in helping and can't follow the code, just PM me or post the question here.
Right now I'm burnt out so hopefully someone can take this to the next level.