Stuck on a simple MA EA
-
Hi, I have a simple idea using a moving average and price. basically on a short time frame, if price moves X distance above moving average sell, and vice versa. I cannot seem to figure out how to do this.
Thanks -Jeff -
Use the "Adjust" field in the Condition block. Put something like "+0.0005" or even "+5pips" in there. A little bit more information about this you can find in the description of the Condition block.
-
__Use the "Adjust" field in the Condition block. Put something like "+0.0005" or even "+5pips" in there. A little bit more information about this you can find in the description of the Condition block.[/quote:12dd3505]
Thank you, always a big help
-
One more question. How do I set it up for optimizing? other wise ill need to go back and constantly change it.
-
Use Constants, as they are actually input parameters for the EA: https://fxdreema.com/demo/mt4-constants
There is a problem if you want to use a constant in "Adjust" to make something like +5pips. Something like +MyConstantpips will not work for obvious reasons
-
I added a constant where i would normally put like "+5pips" but now when I try to test or even run in mt4 nothing happens...

-
+15pips is not a valid for "double" type variable (constant or whatever) at all. "double" variables - the values can be ONLY numeric values with floating point, such as 1.2345 or 2882.38387.
The value can be something like 0.0015 and then in "Adjust" you can put +ConstantName
The problem is that 0.0015 is a fixed number. Someone would recommend to write +toPips(ConstantName) and it will work, but this function is a custom function made by me, and at some point I may decide to change it or remove it