Why did you post once per bar code and then expect it do to anything other than once per bar?
Where is your test for takeprofit was hit? (I assume you mean initial target as there is no open order once takeprofit is hit.)
Where is your test to stop opening multiple orders?
Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
Why did you post once per bar code and then expect it do to anything other than once per bar?
Where is your test for takeprofit was hit? (I assume you mean initial target as there is no open order once takeprofit is hit.)
Where is your test to stop opening multiple orders?
Since there are no slaves here, you have only three choices: Search for it, learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
i try this but not working. so that i try the code above.
for (int a=OrdersTotal(); a>0; a--) {if (OrderSelect(a,SELECT_BY_POS,MODE_HISTORY)==true) {if (!OrderMagicNumber()==magic && !OrderSymbol()==symb) continue; datetime closeT=OrderCloseTime(); } } if((buy==true || sell==true) && closeT==Time[0]){buy=false; sell=false;}
any other suggestion please. thanks
i try this but not working. so that i try the code above.
any other suggestion please. thanks
If you have 5 open orders OrdersTotal() will return 5 and their positions will be at 4, 3, 2, 1 and 0 so your loop is wrong. And OrdersTotal() is the number of open orders, if you want to check the closed orders you need to use something else . .
thanks i will try search other option.
Your code | !OrderMagicNumber()==magic && !OrderSymbol()==symb |
A nonzero magic number | !True==magic && !OrderSymbol()==symb |
OR | False==magic && !OrderSymbol()==symb |
Never true | 0==magic && !OrderSymbol()==symb |
If you have 5 open orders OrdersTotal() will return 5 and their positions will be at 4, 3, 2, 1 and 0 so your loop is wrong. And OrdersTotal() is the number of open orders, if you want to check the closed orders you need to use something else . .
i try this code but still not working..
for (int a=OrdersHistoryTotal(); a>0; a--) {if (OrderSelect(a,SELECT_BY_POS,MODE_HISTORY)==true) {if (!OrderMagicNumber()==magic && !OrderSymbol()==symb) continue; datetime closeT=OrderCloseTime(); } } if((buy==true || sell==true) && closeT==Time[0]){buy=false; sell=false;}
for (int a=OrdersHistoryTotal(); a>0; a--) {if (OrderSelect(a,SELECT_BY_POS,MODE_HISTORY)==true) {if (!OrderMagicNumber()==magic && !OrderSymbol()==symb) continue; datetime closeT=OrderCloseTime(); if((buy==true || sell==true) && closeT==Time[0]){buy=false; sell=false;} } }
Your code | |
A nonzero magic number | |
OR | |
Never true |
i dont know what you trying to say, but i found that useful in selecting orders.. https://www.mql5.com/en/forum/139654
but i dont know if it is ok when selecting history orders.
i try this and not working.
for (int a=OrdersHistoryTotal()-1; a>=0; a--) {if (OrderSelect(a,SELECT_BY_POS,MODE_HISTORY)==true) {if (OrderMagicNumber()==magic && OrderSymbol()==symb) continue; datetime closeT=OrderCloseTime(); if((buy==true || sell==true) && closeT==Time[0]){buy=false; sell=false;} } }
i dont know what you trying to say, but i found that useful in selecting orders.. https://www.mql5.com/en/forum/139654
but i dont know if it is ok when selecting history orders.
i try this and not working.
What does this line do ? can you explain it ?
if (OrderMagicNumber()==magic && OrderSymbol()==symb) continue;
What does this line do ? can you explain it ?
it will continue to next process.
i try other code.. https://www.mql5.com/en/forum/138894
still not working.
static datetime closeT; for(int a=OrdersHistoryTotal()-1; a>=0; a--) {if(OrderSelect(a,SELECT_BY_POS,MODE_HISTORY)==true) {if(OrderMagicNumber()==magic && OrderSymbol()==symb && closeT>OrderCloseTime()) { closeT=OrderCloseTime(); if((buy==true || sell==true) && closeT==Time[0]){buy=false; sell=false;} } } }
- 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 have more than 5 open trades in 1 bar and i want the ea to stop opening order after takeprofit was hit.
i try to insert this to my ea but its only opening 1 order per bar but i prepare to put multiple order in 1 bar. is there other mean to stop opening multiple order after takeprofit was hit?