Hey guys, I am trying to make an EA that makes trades for me based on a 20 EMA. I made one with a program off the internet due to insufficient coding knowledge, but I have tested it several different ways and I can’t figure out why it is not working. Here is how it is supposed to trade.
20 EMA to the high
20 EMA to the low
when the following three conditions are met, the EA initiates a trade.
Long order:
-
the close of the bar from 2 periods ago is below the 20 EMA high.
-
The close from the bar 1 period ago is above the 20 EMA high
2b. The open from the bar 1 period ago is below the 20 EMA high -
The current open is above the 20 EMA high, but not more than 10 pips above or below the precious periods close. This is to avoid trading gaps and needs to be adjusted for a 5 decimal broker so instead of 10 I use 100.
Short order:
pretty much everything is reversed. Where something was below the 20 EMA high the condition is now to be above the 20 EMA low.Ex. The close from the bar 2 periods ago is above the 20 EMA low.
If someone could help me figure this out or point me in the direction of an EA that can do this or something similar for me I would really appreciate it.