xamr88: What i want
- You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button)
and
state the nature of your problem.
No free help
urgent help.Or pay someone. Top of every page is the link Freelance.
-
CustomSpread = (MarketInfo(Symbol(),MODE_SPREAD)) / PipFactor;
MI(spread) returns it in points, not pips. -
TakeProfitPrice = PriceToOpen + (TakeProfit * Point * PipFactor);
Your stops have StopLoss/Takeprofit Points minus spread for buys and that plus spread for sells.) Don't you want the same/specified amount for either direction?You buy at the Ask and sell at the Bid. So for buy orders you pay the spread on open. For sell orders you pay the spread on close.
- Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid reaches it. Not the Ask. Your SL is shorter by the spread and your TP is longer.
- Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask reaches it. To
trigger at a specific
Bid price, add the average spread.
MODE_SPREAD (Paul) - MQL4 programming forum - Page 3 #25 - The charts show Bid prices only. Turn on the Ask line to see how big the spread is (Tools → Options (Control-O) → charts → Show ask line.)
-
TakeProfitPrice = NormalizeDouble(TakeProfitPrice,Digits);
You used NormalizeDouble, It's use is usually wrong, as it is in your case.- Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented
exactly. (like 1/10.)
Double-precision floating-point format - Wikipedia, the free encyclopedia - Print out your values to the precision you want with DoubleToString - Conversion Functions - MQL4 Reference.
- 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 programming 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 programming 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 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 programming 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.
- MathRound() and NormalizeDouble() are rounding in a different way. Make it explicit.
MT4:NormalizeDouble - General - MQL5 programming forum
How to Normalize - Expert Advisors and Automated Trading - MQL5 programming forum
- Floating point has infinite number of decimals, it's your not understanding floating point and that some numbers can't be represented
exactly. (like 1/10.)
-
int total = OrdersTotal(); if (total > 1)
Unnecessary check, if total is zero, your for loop exits immediately. -
int start()
Start using the new Event Handling Functions.
Event Handling Functions - Functions - Language Basics - MQL4 Reference
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
I attach the EA for you to help, im really new on this. THANKS!!!