double MyPoint=Point; if(Digits==3 || Digits==5) MyPoint=Point*10;
It's not a "MyPoint," it's the definition of a PIP. Should call it what it is. adjusting SL, TP, and slippage; for 4/5 digit brokers and for JPY pairs.double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int pipsToPoints = int(pip / _Point);
int pipDigits = (int)MathLog10(pipsToPoints);
int slippage = 3 * pipsToPoints;result=OrderSend(Symbol(),OP_BUYSTOP,AdvancedMM(),Ask,Slippage,0,0,"EA Generator www.ForexEAdvisor.com",MagicNumber,0,Blue); if(result>0)
Check your return codes for errors. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles- You can't move stops closer to the market than MODE_STOPLEVEL.
Requirements and
Limitations in Making Trades - Appendixes - MQL4 Tutorial You can't put a Buy Stop at the market. That fails but you don''t know it because you never report it. #2
- Not adjusting slippage #1
- We hate EA builder
- You couldn't be bothered to learn mql4, therefor there is no common language for us to communicate.
- There are only two choices: learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem, but we are not going to debug your hundreds lines of code.
- EA builder makes bad code counting up while closing multiple orders.
- EA builder makes bad code Bars is unreliable (max bars on chart) volume is unreliable (miss ticks) Always use time. New candle - MQL4 forum
- EA builder makes bad code Not adjusting for 4/5 digit brokers, TP/SL
and slippage:
double pip = StringFind(_Symbol,"JPY") < 0 ? 0.01 : 0.0001;
int pipDigits = (int)MathLog10(pip/_Point);
int pipsToPoints = int(pip / _Point);
int slippage = 3 * pipsToPoints; - EA builder makes bad code not adjusting for ECN brokers.
- EA builder makes bad code not checking return codes.
- EATree uses objects on chart to save values - not persistent storage (files or GV+Flush.) No recovery (crash/reboot.)
OrderSelect(result,SELECT_BY_TICKET); OrderModify(OrderTicket(),OrderOpenPrice(),NormalizeDouble(TheStopLoss,Digits),NormalizeDouble(TheTakeProfit,Digits),0,Green);
#2- Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't
use it. It's use is always
wrong
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
for(int cnt=0;cnt<OrdersTotal();cnt++) { OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
#2- In the presence of multiple orders (one EA multiple charts, multiple EA's,
manual trading)
- You must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
- and check OrderSelect. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
- You must RefreshRates after sleep and between multiple server calls if you want to use the Predefined Variables (Bid/Ask) or OrderClosePrice() instead.
for(int i=0;i<OrdersTotal();i++) { OrderSelect(i,SELECT_BY_POS ,MODE_TRADES); if (OrderMagicNumber()==MagicNumber) result++;
Fails if you put it on other charts but don't change the MN. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forumfor( i=OrdersHistoryTotal()-1;i>=0;i--){ if(OrderSelect(i,SELECT_BY_POS ,MODE_HISTORY)) if (OrderMagicNumber()==MagicNumber) { if(OrderProfit()>=1 && profit1) return(Lots);
You assume history is ordered by date, it's not. Could EA Really Live By Order_History Alone? (ubzen) - MQL4 forum
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Guys, How was your day or trade, hope its okay. Today i wanna share you my EA Script, hope you like it. :)
if You wanna change the script please let me know and share it to in my thread. Sharing is Caring. :)