Greetings,
Thus ls one of my first posts, and i thought that maybe i could find some good experience here... I need help!
I am developing one or my first ea, but i got a problem with ordersend a buystop and sellstop order...
I explain my needs and the little i've done:
I need to hedge positions, so i used a for cycle, with the number of orders i need to be put divided by 2 and then inside the cycle i have 2 ordersend one for the buystop and another for the sellstop.
I also need that the first two hedged to ne spaced 20 pip eachother, and the subsequent orders to be spaced another 20 pip from the previous buystop or sellstop...
I used this sample formula:
BUYSTOP: bid + X(variable) + secondapacing
SELLSTOP: ask + X(as above) - firstspacing - secondspacing
Firstspacing is the first 20 pips between orders and is fixed, while secondspacing is 0 the first for cycle, then becomes:
Secondspacing=secondspacing+20*Point
The stoploss is set to be fixed at 500pips high or low depending if buystop ore sellstop.
Ok, now the problem is that sometimes the first buy order or the first sell order isn't entered and returns error 130 = invalid stops.
As the problem can't be the stoploss as it's correctly set for the subsequent orders, could the problem be that the entry price for the pending orders is too close from the market bid price?
I am using fxdd demo.
Thanks for reading me,
jj
Thus ls one of my first posts, and i thought that maybe i could find some good experience here... I need help!
I am developing one or my first ea, but i got a problem with ordersend a buystop and sellstop order...
I explain my needs and the little i've done:
I need to hedge positions, so i used a for cycle, with the number of orders i need to be put divided by 2 and then inside the cycle i have 2 ordersend one for the buystop and another for the sellstop.
I also need that the first two hedged to ne spaced 20 pip eachother, and the subsequent orders to be spaced another 20 pip from the previous buystop or sellstop...
I used this sample formula:
BUYSTOP: bid + X(variable) + secondapacing
SELLSTOP: ask + X(as above) - firstspacing - secondspacing
Firstspacing is the first 20 pips between orders and is fixed, while secondspacing is 0 the first for cycle, then becomes:
Secondspacing=secondspacing+20*Point
The stoploss is set to be fixed at 500pips high or low depending if buystop ore sellstop.
Ok, now the problem is that sometimes the first buy order or the first sell order isn't entered and returns error 130 = invalid stops.
As the problem can't be the stoploss as it's correctly set for the subsequent orders, could the problem be that the entry price for the pending orders is too close from the market bid price?
I am using fxdd demo.
Thanks for reading me,
jj