i want the distance between (open price-EMA)*2 for take profit
i want the distance between (open price-EMA)*2 for take profit
Loading saved threads...
Armin Abolfathi · External communityPost link
External question — Stack Overflow Stack Exchange
Author: Armin Abolfathi
Original post: https://stackoverflow.com/questions/70536381
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
in my expert i want the distance between (open price-EMA)*2 for take profit?how can i do this in mql4?
i use this formula for buy position but it does not work
Ask+((Bid-EMA)*2)
Quote
Report
PaulB · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: PaulB
Original post: https://stackoverflow.com/a/70548637
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
Your question references Open Price, but you are using Bid, this is incorrect. You should be using something like the following
int ema_period=20;
double EMA=iMA(NULL,0,ema_period,0,MODE_EMA,PRICE_CLOSE,0);
double take_profit=Ask+MathAbs(iOpen(NULL,0,0)-EMA)*2;
You should also check that your take profit is far enough away from the current price to be accepted by the trade server (using
MarketInfo(NULL, MODE_STOPLEVEL)
).
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: Armin Abolfathi Source score (net votes, not local likes): 1 Original post: https://stackoverflow.com/questions/70536381 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. in my expert i want the distance between (open price-EMA)*2 for take profit?how can i do this in mql4? i use this formula for buy position but it does not work Ask+((Bid-EMA)*2)
Checking account access…