double entry_price = NormalizeDouble(price,_Digits); double sl_price = NormalizeDouble(price + StopLoss * _Point, _Digits); double tp_price = NormalizeDouble(price - TakeProfit * _Point, _Digits); double ema = iMA(NULL, PERIOD_M5, EMA_Period, 0, MODE_EMA, PRICE_CLOSE, 0); double wma = iMA(NULL, PERIOD_M5, WMA_Period, 0, MODE_LWMA, PRICE_CLOSE, 0); if (ema > wma) { double accountBalance = AccountBalance(); }
';' - unexpected end of program (line 80)
'{' - unbalanced parentheses (line 31)
-
Why did you post your MT4 question in the MT5 EA section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon. -
Please edit your (original) post and use the CODE button (or Alt+S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum #25 (2019)
Forum rules and recommendations - General - MQL5 programming forum (2023)
Messages Editor -
void OnTick() { <<<<< OnTick starts ⋮ if (ema > wma) { <<<<< IF starts double accountBalance = AccountBalance(); <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Where is the rest of the IF? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Where is the closing brace of the IF? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Where is the rest of OnTick? <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Where is the closing brace of ontick?
-
double sl_price = NormalizeDouble(price + StopLoss * _Point, _Digits); double tp_price = NormalizeDouble(price - TakeProfit * _Point, _Digits);
You buy at the Ask and sell at the Bid. Pending Buy Stop orders become market orders when hit by the Ask.
-
Your buy order's TP/SL (or Sell Stop's/Sell Limit's entry) are triggered when the Bid / OrderClosePrice reaches it. Using Ask±n, makes your SL shorter and your TP longer, by the spread. Don't you want the specified amount used in either direction?
-
Your sell order's TP/SL (or Buy Stop's/Buy Limit's entry) will be triggered when the Ask / OrderClosePrice reaches it. To trigger close 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.)
Most brokers with variable spreads widen considerably at end of day (5 PM ET) ± 30 minutes.
My GBPJPY shows average spread = 26 points, average maximum spread = 134.
My EURCHF shows average spread = 18 points, average maximum spread = 106.
(your broker will be similar).
Is it reasonable to have such a huge spreads (20 PIP spreads) in EURCHF? - General - MQL5 programming forum (2022)
-
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Theres only 2 errors and i cant seem to fix it,
';' - unexpected end of program (line 80)
'{' - unbalanced parentheses (line 31)
double entry_price = NormalizeDouble(price, MarketInfo(Symbol(), MODE_DIGITS));
double sl_price = NormalizeDouble(price + StopLoss * MarketInfo(Symbol(), MODE_TICKSIZE), MarketInfo(Symbol(), MODE_DIGITS));
(line 80) double tp_price = NormalizeDouble(price - TakeProfit * MarketInfo(Symbol(), MODE_TICKSIZE), MarketInfo(Symbol(), MODE_DIGITS));
}
void OnTick()
{-------------------------------------------------------- (line 31)
double ema = iMA(NULL, PERIOD_M5, EMA_Period, 0, MODE_EMA, PRICE_CLOSE, 0);
double wma = iMA(NULL, PERIOD_M5, WMA_Period, 0, MODE_WMA, PRICE_CLOSE, 0);
if (ema > wma)
{
double accountBalance = AccountBalance();
thank you