brad: Assistance appreciated.
if(!OrderSelect(0,SELECT_BY_POS)) Print("Error: Unable to select order! code #", GetLastError());
This makes the EA incompatible with every other EA including itself (on other charts) and manual trading. Use a OrderSelect loop and magic number. Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 forumif(OrderType() == OP_BUY) { // if SL reached and trade is loss if(Ask <= OrderStopLoss() && OrderProfit() < 0)
You buy at the Ask and sell at the Bid. So for a buy the SL is at the bid. If the Ask is below the SL, the Bid is definitely below, and the order has already been closed by the broker. This code will never execute.boxTop = StrToDouble(DoubleToStr(levels[i],4)); boxBottom = StrToDouble(DoubleToStr(levels[i-1],4));
Why are you converting a price to a string and back to a price? boxTop = levels[i];- You don't even need that array
boxBottom = boxSize * int(Bid / boxSize); boxTop = boxBottom + boxSize;
if (orderOpened) { for (int i = 0; i < totalOrders; i++)
In the presence of multiple order you MUST count down. Get in the habit. Loops and Closing or Deleting Orders - MQL4 forumactioned = true;
When do you ever reset that?- Neither of the orders are ever opened and there is no progress after that. I suspect this is due to my code...How can it be due to your code. The orders are pending on market price. Your code it irrelevant. You didn't run the tester far enough for the market to trigger your order.
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 there,
I'm trying to test modifications to the martingale system. So far I've coded enough to play around with some parameters like how much to multiply volume on losing trades. I tried to run this in Strategy Tester which only shows 2 items in the Results ta (as below) b i.e. orders to open. Neither of the orders are ever opened and there is no progress after that.
I suspect this is due to my code rather than my Strategy Tester settings.. The code is below.
Assistance appreciated.
Thanks,
Brad