saman89200: . the idea is simply if a 15 min candle closes a
-
Why did you post your MT4 question in the
Root /
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
Next time post in the correct place. The moderators will likely move this thread there soon. - Where do you check for a new bar?
- You can't buy at the close price of a bar (close_15,) only at the current market price (Ask.)
-
Check your return codes for errors, report them
and you would know why.
Don't just silence the compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after. if(OrdersTotal()<1)
Using OrdersTotal directly and/or no Magic number filtering on your OrderSelect loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 and MetaTrader 4 - MQL4 programming forum
MagicNumber: "Magic" Identifier of the Order - MQL4 Articles-
Don't double post!
General rules and best pratices of the Forum. - General - MQL5 programming forum
saman89200:
this is the part of my code that has problem..... the idea is simply if a 15 min candle closes above the pp line it has to open a buy order it simply doesnt open it.....i have similar conditions for sell order but that works... i changed the price and sl and tp and used RefreshRates and even changed slippage it doesnt work... whats the problem
Try changing this:
OrderSend(symbol,OP_BUY,lots,Ask,slippage,close_15-stoploss*Point,close_15+take_profit*Point)
And check Experts / Journal tabs of the Terminal for error messages.

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
this is the part of my code that has problem..... the idea is simply if a 15 min candle closes above the pp line it has to open a buy order it simply doesnt open it.....i have similar conditions for sell order but that works... i changed the price and sl and tp and used RefreshRates and even changed slippage it doesnt work... whats the problem