if ((KValue1<DValue1)&&(KValue2>DValue2))
- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - You are looking at a signal. Act on a change of signal.
MQL4 (in Strategy Tester) - double testing of entry conditions - Strategy Tester - Expert Advisors and Automated Trading - MQL5 programming forum #1 - Or, only process new candles.
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
New candle - MQL4 programming forum - Or check for open order(s) before opening more.
So you can allow it to only open an order when
if(OrdersTotal() == 0) { // Do something... }

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,
I wrote a mql5 ea code to buy to open on stochastic oversold and sell to open on stochastic overbought, at %K and %D crossover. However when it hits the necessary requirements for entry the buy and sell are executed but multiple buys are triggered, or multiple sell are triggered and multiple tickets at the same time. I intend to have only one entry, that is, one ticket at any one time. That is, to close an open position before an entry at the overbought and oversold areas.
My sample code for overbought is like this, for sell-to-open: [it seems by this code, multiple open ticket iteration happens. I intend to have only one ticket entry at a time]. Please assist.