Robot not placing order at stated price

 

I have made an EA. When i place a buy order, to make a profit, the ask and bid price should go up. However, i have made my EA so that when it goes the wrong way xpips, it places another buy order. if it continues to go in the wrong direction by 2xpips, it will place another buy order. If the market changes direction, the last order will only have to travel a certain distance up and when the overall profit is positive, the EA will close all orders. However, sometimes, when it placed the order on the next levels, it not exactly that levels that i specified. I will attach my code to this. Can someone please help me. I think its to do with the line where i say "if (Ask<= traderange_buy1) {". I have tried "==" but only the "< or >" signs work. My who goal is just when price hits the level specified, place new order.


Thank you


Here is the code:

Files:
swingsystem.txt  16 kb
 
k.kieren99:


i have made my EA so that when it goes the wrong way xpips, it places another buy order. if it continues to go in the wrong direction by 2xpips, it will place another buy order. If the market changes direction, the last order will only have to travel a certain distance up and when the overall profit is positive, the EA will close all orders.

However, sometimes, when it placed the order on the next levels, it not exactly that levels that i specified.

I have tried "==" but only the "< or >" signs work.

  1. A variation on Martingale, guaranteed to blow you account eventually. https://www.mql5.com/en/search#!keyword=martingale& module=mql5_module_forum
    Do you really think you have a big enough account size to open 64 lots (and won't get a margin call?)
  2. Print out your variables, and find out why.
  3. Doubles are rarely equal and prices do not change by only a point. The == operand. - MQL4 forum
Reason: