Finally—I'm beginning to get somewhere... Though this EA is not yet profitable, I at least have some ideas on how I might be able to turn this around. And even if not, if nothing else, it has highlighted a methodology that should yield excellent results when traded manually.
This is the EA I'll want to use. All I need to do now is figure out how to tell MT4 to exit with profit instead of setting a fixed number of pips as the stop loss and take profit... Creating an Expert Advisor from an Arrow Painting Custom Indicator Upload the indicator to the list of indicator conditions. Make each indicator buffer's "is not equal to" Value 0 (one in the Open Buy Order and the other in the Open Sell Order). Limit the Maximum Open Trades to 1 (under the Common tab). Set the Fixed Size in Lots under Money Management. Select Audible Alerts for Errors and Each Order. Add Trade Size and Audible Alerts to Inputs. Set the stop loss and take profit parameters (as Inputs, if desired). Copy the resulting Source Code. It might take me a week or two to come up with the right recipe (if ever), but at least it now feels like a possibility...
If I can filter out the elements that are not working and allow those that are working to remain, I should be in good shape...
The above approach relied on a fixed stop loss and take profit target, which is not really my preference. Instead, it looks like the methodology used below will be my starting point. The program understood what I told it to do and then did it as requested—finally. It was also able to trade the system to more or less break even. So, my plan is to use this as a basic framework and see if I can't add more detailed instructions that will eliminate as many losses as possible while holding on to the gains.
Around trade twenty-two I was hoping that this just might work out. But alas, it was not to be. However, I have an idea of what could be an adjustment that just might turn this all around, so I will come back to it later on today... (At least things pretty much held steady from trades eighty-four to one hundred twenty-five.)
I was late loading the graphics onto the chart, so I missed seeing why this strategy started off with a number losing trades. However, based on how it works, I suspect I will be able to fix this problem. I'm hoping it will be taken care of by the same adjustment I made that should eliminate the losing trades at the end. I also have an idea for a version of this approach that will result in a much greater number of trades being executed—perhaps significantly more. My plan is to run both of these tests tomorrow, and if the outcomes are better than the above results, use the two EAs in my demo accounts next week to see what happens.
This is so stupid. I'm telling MT4 to enter positions when the yellow moving average crosses back inside the moving average envelope and to exit trades at the mean. At least it approximated this action at points A and C, but at B it executed a (losing) trade with the moving average positioned outside of the envelope! What the heck is it doing? Same thing below. At point D, the program behaved as expected. But, at point E it went bonkers again and entered a position, even though the moving average was NOT crossing back into the envelope. Needless to say, I'm not at all amused!
Trade A is not doing what you describe. It should have entered the position a few bars later. Only trades C and D are having their entry points at the desired position. Are you still using bars that have not yet been completed (shift zero)? That could cause "jitter" around your entry point which is not visible when you look at the results afterward. Rerun your backtest and pay detailed attention to what the yellow line is doing near the A and B entry times.
That's why I said "approximated" the action. My system of trading relies on instantaneous entries, but I just moved down to a lower time frame where I am taking everything that worked best with the charts I was using earlier, and translating them down to a more "microscopic" time frame. So now, if I use shift one (1), I should be okay in that a little bit of lag at this level should not do much damage. Thanks for the information about "jitter." You are one of the few members here at ET who I have had respond to things I've written in one of my journals (since August of 2017) that is actually helpful information—the kind of interaction I thought I would find here, but which I have sadly found to be the exception rather than the norm. Thanks again!.
You're welcome. Curiosity is what keeps me here: reading about your experiments and the issues you encounter. A learning curve will eventually lead to a nice equity curve.