Forum on trading, automated trading systems and testing trading strategies
How to Start with Metatrader 5
Sergey Golubev, 2016.05.08 20:17
Welcome,
- Usually people who can't code don't receive free help on this forum, though it could happen if you are lucky, be patient.
- If you show your attempts and describe well your problem, you will most probably receive an answer from the community.
- If you don't want to learn to code, nothing bad, you can either look at the Codebase if something free already exists, or in the Market for paid products (sometimes free also).
- Finally, you also have the option to hire a programmer in the Freelance section.
Hi Guys,
My EA that I created is based on momentum and works extremely well when there is either an upward or downward trend. Not so much when markets are trading relatively flat.
I need a way to counter this and the idea I have is to simply add a minimum mandatory difference between a 7 period MA and a 21 period MA. For example, no trades (neither long or short) can be entered unless
abs(7EMA - 21EMA) >= 0.01
Has anyone used this type of strategy before? What would you recommend should I make the minimum difference?
If anyone has a better idea, I'm all ears?
Thanks in advance!
Anton
EDIT: I am specifically focusing on the EMA of a 15min chart
Hi Amton,
I think what you trying to do is to use gradient of the slope to determine whether the market is in a consolidation phase or not. I have tried this but did not work for me. I tried bit differnetly, ex: 20EMA(t) - 20EMA(t-n) >= 0.000xx. Thoughts are welcome.
Hi Amton,
I think what you trying to do is to use gradient of the slope to determine whether the market is in a consolidation phase or not. I have tried this but did not work for me. I tried bit differnetly, ex: 20EMA(t) - 20EMA(t-n) >= 0.000xx. Thoughts are welcome.
Hi there,
Thanks for your response! I'm posting a picture of my last couple of days trading to explain.
In both upward and downward trends my code does really well and consistently hits TP and an occasional SL, but once the market is flat I start to lose.
You can see in trends the 15min MA (7period) and 15min MA (21period) are far apart from each other. When markets are flat, the moving averages are close to each other and I start to lose.
I want to add a line that restricts all trades if the 2 Moving averages are close to each other (Like in the problem area of my picture). The question I have is how much should I make that minimum amount? So I wonder if anyone has used this before and what their minimum was?
The other question is if I for example used a minimum of 0.001 (on EURUSD), will this amount be effective universal over other symbols too such as USDJPY? Brent Crude?
Or would it be better to code a minimum percentage, for example:
Minimum percentage --> MA(7)/MA(21) - 1 >= abs(0.02%)
This might be better so that it can be used across any Symbol. If I used that would do you think would be a good percentage to use?
This is the problem with short timeframes isn't it.... trends flatten out and whipsaw your account to pieces.
Many people try putting a timer on their trading so there are blackout periods for when the market is slow, like the Asian market hours for some pairs and CFDs.
I have also tried a counter that if I had 3 losing trades in a row the EA went to sleep for XX bars and then started trading again.
There are slope directional approaches that require to be showing widening trend lines over a period of XX periods.
There are negative Martingale methods where the second, third, and fourth... etc trades are smaller and smaller. There is more than one way to do this with the code.
However, as far as I know, there is no way around the whipsaws of short term trading. I could never do it so I don't try using short term trading anymore.
Good luck, let us know if you find a solution to this problem.
You think that the ea identifies the trends ok, and the problem is only when there is no trend. Let me doubt that this is so.
The real description is that the ea expects a trend, a smooth one in which it can open an order and close in profit.
It's not that it works in trend markets and now you need to bypass the flat market, but the opposite.
It expects a trend, and when it starts it buys or sells, but it fails when the trend does not develop.
You can not foretell which trend will develop or not, that is why the whole idea is wrong.
This will not succeed.
Sergey Golubev: I think the users will reply with something more reasonable than I replied but it is just my usual standard reply above sorry.
| My standard reply |
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Guys,
My EA that I created is based on momentum and works extremely well when there is either an upward or downward trend. Not so much when markets are trading relatively flat.
I need a way to counter this and the idea I have is to simply add a minimum mandatory difference between a 7 period MA and a 21 period MA. For example, no trades (neither long or short) can be entered unless
abs(7EMA - 21EMA) >= 0.01
Has anyone used this type of strategy before? What would you recommend should I make the minimum difference?
If anyone has a better idea, I'm all ears?
Thanks in advance!
Anton
EDIT: I am specifically focusing on the EMA of a 15min chart