Step Ma EA - page 17

 
jayjonbeach:
Hi there. First of all, thank you for all your work on this. I played around with this for some time, here are my comments:

1. BE SL was NOT working. Like many other bots with BE SL, it was waiting the right amount of time but then adjusting the SL to the CURRENT price, instead of to the entry price. After spending some time looking over the code, I was able to see where it was going wrong in the logic, and corrected the problem. Attached is the same robot, but the BE SL now works. Note, the gap variable is now not used, and the BE has been hard-coded to adjust the SL to entry plus or minus TWO pips to account for spread. So your choice here just remains how far in profit you want price to move before it kicks in, and you set that as the value in external inputs.

2. TS, not fully tested but I think works correctly!

3. Each tick mode true did not yield any trades, not sure why.

4. With SL set to false, it was still using a SL so must be error in code. This is likely easy to get around by putting the value at 0, I did not test this theory however, at any rate least of the things to worry about can put 500 also to get around this.

5. Code allows up to 3 trades to be entered at one time, I think this is different than prior versions. I had an idea for pyramiding, but I think it is working much differently here, and I found added positions were usually losing in my tests. I can't remember if max lots set to 1 only allows one trade, likely. Note also a buy order was allowed to open even if a sell order was already open, which seemed conflicting and won't work on non-hedge accounts.

-----

The MAIN thing different here is the entry and exit rules. I think you said it is looking 3 candles back to verify trend is really changing, but this also means getting in or out VERY late sometimes, and my tests confirmed this (might be fine for H4 + charts, but not good for smaller TF's imho). Also, prior candles are being compared to each other (if I read code correctly), as I think another member suggested earlier, and this can cause you to miss some moves completely, in hopes of only catching better moves, which won't always work. Furthermore, the same logic was applied to exits and kicked the trader out of trades MUCH too early at times, and yet at other times the trade did not exit when it really would have normally so ignored a Step exit signal completely which I found very concerning.

Having said that, I think there is some potential for this type of logic in the entry and maybe even the exit. Much more testing is needed, and unfortunately I won't have much time in the next few weeks. I do think the logic needs to be changed however from its current form.

---

In summary, this was quite a departure overall from v7 for sure, not sure about the others. I will be trying to stick to v7 for now, for one I am not entirely sure of the exact entry and exit rules here, and I seen some things I did not like in the testing. Will hope to get the TS and BE SL to work on v7, hopefully by using the same code as in this one on it. That or we could use this version and apply the old entry/exit rules here instead of the new ones, but hopefully you or I can make this happen (note, I think YOU have a much better chance than I do!) Once it gets to that point and I can do a bunch of testing, I have a couple good ideas (well 100+ but narrowed down to 2 or 3 ) on how to improve the exit, which I think is all that will be needed.

Of course this is all only my amateur coding opinion, YMMV.

P.S. - Interesting enough I was able to get this version profitable on EU H1, but I think it was luck (time period) as I could not on a few other pairs.

Hi Jayjonbeach,

Sorry for all the problems,and Thanks for your testing, the entry and exit have not changed only thing is on the exit there is 2 external parameters closeBuybar and closeSellbar, they are by default set to 3, if you change them to 1 and leave each tick mode = false you will be trading and exiting on first closed bar, just like the other Ea. the exit should work this way if you exit by using extern bool stoponstepma = true. Each tick mode means on still open bar which is dangerous IMHO, especially with this indicator, anyway guess another try in the dumpster. About the indicator on the last version I was forward testing the v7 EA with the indicator alongside think it was on M15 time frame, Ea had entered a buy perfectly according to the indicator which had changed from downtrend(red) to uptrend(blue), later that evening was checking out the trade to see if the trailing had kicked in and there was still the entry arrow but the indicator had changed to total blue, back at the original entry, I refreshed the indicator and it went back to red, this is a problem, I tried to fix by calling buffer 3 and 4 in the indicator, these 2 buffers determine the trend that is why you see Close[Current] > Buy1_1(which is buffer 4) and Close[Current+1] <= Buy1_2(which is buffer 4 but 1 bar back) and sells the opposite but it had to be buffer 3 for sells.I did it this way hoping to bypass the problems with the trend buffer, the problem being not refreshing or maybe even the other R word,and didn't mention it because I thought it was fixed by doing what i did, so sorry to say probably won't update until the indicator is fixed, I have tried, came close to fixing it but no cigar. If it gets fixed or I am able to fix will gladly update with a fully working Ea that I will not post until am sure all the possible bugs are gone, and again sorry for the problems.

 
mrtools:
Try this one it was from a Stoch Ea i modified awhile back it is trading and market hasn't moved enough to see if the trailing is working, but maybe you can try it back testing, has that and an untested break even, has a close on step ma mode by default it is set to true, the close buy and close sell if it is set to 1 should close when the color changes, by default have it set to 3 to make sure the trend has changed. The timefilter should be by GMT time now, and for this Ea to compile you will need TimeGMT in your experts/include file.Eventually i hope to code this include file directly into the Ea's making it an option to use either your brokers time or gmt time for the time filter. ps) trailing kicked in

Please can you tell me where to get StepMA_v7.ex4 to be able to start and I EA:

Look message of expert:

2012.09.25 10:41:53 Can not open file 'C: \ Program Files \ MetaTrader FIX \ experts \ indicators \ StepMA_v7.ex4' on the EURUSD, M1

 
gtudor:
Please can you tell me where to get StepMA_v7.ex4 to be able to start and I EA:

Look message of expert:

2012.09.25 10:41:53 Can not open file 'C: \ Program Files \ MetaTrader FIX \ experts \ indicators \ StepMA_v7.ex4' on the EURUSD, M1

Hi Gtudor

Try here

https://www.mql5.com/en/forum/general

post#116

 

StepMA_v7 indicator?

It is on this post:

https://www.mql5.com/en/forum/general

Download it and place in indicator folder, after that - compile or restart metatrader.

 

Thanks !

Thank you very mrtools and newdigital!

 
mrtools:
Hi Jayjonbeach, Sorry for all the problems,and Thanks for your testing, the entry and exit have not changed only thing is on the exit there is 2 external parameters closeBuybar and closeSellbar, they are by default set to 3, if you change them to 1 and leave each tick mode = false you will be trading and exiting on first closed bar, just like the other Ea. the exit should work this way if you exit by using extern bool stoponstepma = true. Each tick mode means on still open bar which is dangerous IMHO, especially with this indicator, anyway guess another try in the dumpster. About the indicator on the last version I was forward testing the v7 EA with the indicator alongside think it was on M15 time frame, Ea had entered a buy perfectly according to the indicator which had changed from downtrend(red) to uptrend(blue), later that evening was checking out the trade to see if the trailing had kicked in and there was still the entry arrow but the indicator had changed to total blue, back at the original entry, I refreshed the indicator and it went back to red, this is a problem, I tried to fix by calling buffer 3 and 4 in the indicator, these 2 buffers determine the trend that is why you see Close[Current] > Buy1_1(which is buffer 4) and Close[Current+1] <= Buy1_2(which is buffer 4 but 1 bar back) and sells the opposite but it had to be buffer 3 for sells.I did it this way hoping to bypass the problems with the trend buffer, the problem being not refreshing or maybe even the other R word,and didn't mention it because I thought it was fixed by doing what i did, so sorry to say probably won't update until the indicator is fixed, I have tried, came close to fixing it but no cigar. If it gets fixed or I am able to fix will gladly update with a fully working Ea that I will not post until am sure all the possible bugs are gone, and again sorry for the problems.

Hey mate. No apologies please, I am just grateful you are trying to fulfill a request and help to try and bring a vision to reality. I'm also grateful you post these files even not fully tested and with potential bugs, since that is all anyone could ask surely (and even that is a lot) and then its up to us to test them. I can see now with coding that nothing is as straight forward as it first looks, and unless someone is a "master" coder (and maybe even then), this kind of tweaking and trial and error is a normal process.

On the entry/exit, all I can tell you is things were VERY different on the charts. What I have been doing is running a backtest in strat tester, and then comparing results on a live chart making sure robot is doing what it is supposed to. Up to this version it always was, but this time things got very different as I reported. I did try close_buy = 1 and it did not seem to change my results, which I found kind of erratic and not matching the Indy, some entries and entries were ignored and all were very late. I did have stoponstepma true for all tests and tick mode false (as true gave no trades).

On the Indy, I have never seen what you are citing. The first thing I did before spending a bunch of time with it was to put it on M1 chart with Snapshot Indy and leave it 12 hours. Next morning I made sure to change TF to M5, then back to M1 (to refresh) before comparing results. All the pictures (taken of live chart of course) matched everything that was in the past, so there was no "perfecting" effect. I also spent some hours watching in realtime with my own eyes, and have traded the signals manually doing so as well. The only thing I ever noticed was the current candle repainting like probably all Indy's do.

However, I have noticed that the COLOUR of the Indy can sometimes be wrong, and it can be seen in backtest as well. To clarify this further, what I do see very occasionally is maybe what you are seeing. Sometimes the Indy gets "whipped" by price, and in that instance, say the Indy "steps down" briefly, only to be whipped back up after, well the "step down" can actually be left with a blue colour instead of a red one. This is why when I coded the original EA, I did not use colour but the "angle" of the Indy, or rather where it was in relation to itself. So if the Indy is higher on the past candle, than it was on 2 candles past, that is a buy signal regardless of colour.

So now I wonder if this last paragraph is the same thing you were seeing? Edit, hmmm I re-read what you wrote and I don't think so. It sounds like there could be two issues with Colour (or maybe they are same and/or related), since what you seen seems much more like repainting (maybe by accident, versus some Indy's doing it on purpose) rather than a failure to change the colour when it should (what I seen). The saving grace here to me, is I really don't think the colour matters at all if you use the angle or the price of the Indy versus itself as I cited above. It could trip someone up trading manually maybe, but the robot can ignore colour completely, and I never seen the angle or the painted line ever change once I candle closed, but you never know maybe I just missed seeing it to (don't think so). Did you see the line change or only the colour as you said?

I hope this helps somewhat and thanks again for all your help and time

 
jayjonbeach:
In summary, this was quite a departure overall from v7 for sure, not sure about the others. I will be trying to stick to v7 for now, for one I am not entirely sure of the exact entry and exit rules here, and I seen some things I did not like in the testing. Will hope to get the TS and BE SL to work on v7, hopefully by using the same code as in this one on it. (note, I think YOU have a much better chance than I do!)

Thought I had it, after about 5 hours of mucking around, 0 errors 0 warnings!

However, the BE and TS are not kicking in, even though I am using the code from the version where they work. Maybe I didn't put them in such a good spot, was trying to match the version where they came from.

Back to drawing board, but I think I'm getting close. Any luck?

Files:
 
jayjonbeach:
Thought I had it, after about 5 hours of mucking around, 0 errors 0 warnings!

However, the BE and TS are not kicking in, even though I am using the code from the version where they work. Maybe I didn't put them in such a good spot, was trying to match the version where they came from.

Back to drawing board, but I think I'm getting close. Any luck?

Hi Jayjonbeach,

Still working on the indicator, thanks for your Ea., moved the TS and BE to the buy and sell routine, not able to back test maybe you can try it like this, to see how or if it works.

ps) realized there is an open order counter there(if (openedOrders=0), and no way would work, need to figure a way around it, think that"s the ticket.Cant find the "duh" smiley for me. Will repost once i find a way around it

 
mrtools:
Hi Jayjonbeach,

Still working on the indicator, thanks for your Ea., moved the TS and BE to the buy and sell routine, not able to back test maybe you can try it like this, to see how or if it works.

ps) realized there is an open order counter there(if (openedOrders=0), and no way would work, need to figure a way around it, think that"s the ticket.Cant find the "duh" smiley for me. Will repost once i find a way around it

I too am working on this still, and getting frustrated now. I think the close order place IS the right place to put a TS , not the new order place(for one thing what you noted), and I am still trying to get it to work. I am now using a working version (I had to fix it) of Mr. Pips 3 level TS, and this is how it does it. If there is an open order, should it closed? If no, (else) then should it be modified? If yes, the TS kicks in.

Note that there are two levels BEFORE the TS kicks in. So if price moves ____ pips, move SL to BE. If moves ___pips, move SL to BE+ _____. If moves ____pips, then TS finally kicks in. This is definitely what I would like to see for this EA, and there was an error in the TS on the Mr. Pip EA but I found it and fixed it. So the Mr. Pip EA works great, all 3 levels, but when I try to transfer it over to here once again I am having difficulties.

I don't want to abandon this main framework if we can help it, just because the signal, Money Management, Time Filter, SL and TP are all working, and the only thing missing before we can move forward with possible filters, etc is more than one time option (like Asian session, LS, and NY session all selectable) and this multi-level TS (which can include BE). Sometimes I find a good EA like this Mr. Pip one, but the MM doesn't work, or the Time Filter doesn't work. Crikey is there one good EA out there where everything works!!!??? Hard to find, it seems.

Anyway I know I am close, and I am learning a lot through this process, but sure wish I knew code better.

 
jayjonbeach:
I too am working on this still, and getting frustrated now. I think the close order place IS the right place to put a TS , not the new order place(for one thing what you noted), and I am still trying to get it to work. I am now using a working version (I had to fix it) of Mr. Pips 3 level TS, and this is how it does it. If there is an open order, should it closed? If no, (else) then should it be modified? If yes, the TS kicks in.

Note that there are two levels BEFORE the TS kicks in. So if price moves ____ pips, move SL to BE. If moves ___pips, move SL to BE+ _____. If moves ____pips, then TS finally kicks in. This is definitely what I would like to see for this EA, and there was an error in the TS on the Mr. Pip EA but I found it and fixed it. So the Mr. Pip EA works great, all 3 levels, but when I try to transfer it over to here once again I am having difficulties.

I don't want to abandon this main framework if we can help it, just because the signal, Money Management, Time Filter, SL and TP are all working, and the only thing missing before we can move forward with possible filters, etc is more than one time option (like Asian session, LS, and NY session all selectable) and this multi-level TS (which can include BE). Sometimes I find a good EA like this Mr. Pip one, but the MM doesn't work, or the Time Filter doesn't work. Crikey is there one good EA out there where everything works!!!??? Hard to find, it seems.

Anyway I know I am close, and I am learning a lot through this process, but sure wish I knew code better.

Hi Jayjonbeach,

Am testing this version,(v7) with a different trailing stop will see how it goes if it works will post it.

Reason: