change
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
i=0; buy=0; sell=0;
orders=OrdersTotal();
for (i=0;i<=orders;i++)
{
OrderSelect(i,SELECT_BY_TICKET);
price_open=OrderOpenPrice();
if (price_open==price_buy) buy=1;
if (price_open==price_sell) sell=1;
if (buy==0) OrderSend(Symbol(),OP_BUYSTOP,lots,price_buy,3,0,price_buy+Point*tp,"",111,0,Blue);
if (sell==0) OrderSend(Symbol(),OP_SELLSTOP,lots,price_sell,3,0,price_sell-Point*tp,"",111,0,Red);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
why the check won't work? it still opens orders where there's already open orders.
i=0; buy=0; sell=0;
orders=OrdersTotal();
for (i=0;i<=orders;i++)
{
OrderSelect(i,SELECT_BY_TICKET);
price_open=OrderOpenPrice();
if (price_open==price_buy) buy=1;
if (price_open==price_sell) sell=1;
if (buy==0) OrderSend(Symbol(),OP_BUYSTOP,lots,price_buy,3,0,price_buy+Point*tp,"",111,0,Blue);
if (sell==0) OrderSend(Symbol(),OP_SELLSTOP,lots,price_sell,3,0,price_sell-Point*tp,"",111,0,Red);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
why the check won't work? it still opens orders where there's already open orders.
As abouve, you should select by ticket. You should also check return value from orderselect, as you are looping more iterations that you have orders. You should learn how to compare doubles.
change
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
i tried that already. still the same problem.
change
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
i tried that already. still the same problem.
You should really learn how to compare doubles. Use Google.
change
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
OrderSelect(i,SELECT_BY_TICKET);
to
OrderSelect(i,SELECT_BY_POS);
i tried that already. still the same problem.
You should really learn how to compare doubles. Use Google.
Ok. i think i got it. thanks!
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
i=0; buy=0; sell=0;
orders=OrdersTotal();
for (i=0;i<=orders;i++)
{
OrderSelect(i,SELECT_BY_TICKET);
price_open=OrderOpenPrice();
if (price_open==price_buy) buy=1;
if (price_open==price_sell) sell=1;
if (buy==0) OrderSend(Symbol(),OP_BUYSTOP,lots,price_buy,3,0,price_buy+Point*tp,"",111,0,Blue);
if (sell==0) OrderSend(Symbol(),OP_SELLSTOP,lots,price_sell,3,0,price_sell-Point*tp,"",111,0,Red);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
why the check won't work? it still opens orders where there's already open orders.