It appears that you are using the 'sl' variable to set the price level of the stop orders.
You are setting both the sellstop and buystop at the same price.
If the intended price for the buy order is below the current Ask price, then you need to use a BUYLIMIT order.
If you want to set a BUY order at a future price, you use a STOP order. And this will be triggered when the price rises to meet it.
If you want to set a BUY order at a previous price, you use a LIMIT order. And this will be triggered with the price falls to meet it.
SetOrder(OP_SELLSTOP, 1.2, sl, 0, sl- 0.0005, Time[i]);
SetOrder(OP_BUYSTOP, 0.7, sl, sl-0.0005, 0, Time[i]);
It appears that you are using the 'sl' variable to set the price level of the stop orders.
You are setting both the sellstop and buystop at the same price.
If the intended price for the buy order is below the current Ask price, then you need to use a BUYLIMIT order.
If you want to set a BUY order at a future price, you use a STOP order. And this will be triggered when the price rises to meet it.
If you want to set a BUY order at a previous price, you use a LIMIT order. And this will be triggered with the price falls to meet it.
It works. Thank you very much...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want the EA to place two opposite pending orders in order to what I put below but it makes just the one(first) pending order in both YELLOW or WHITE case. For example in the YELLOW case the EA would place just SELLSTOP(1.2). Please help if know my mistake.
the SetOrder() function is:
and Error 130 is reported.