How Can I delay a trade with 10bar after it has an already existing trade.
Check the OrderOpenTime() convert it to a bar number using iBarShift() if that bar number is less than 10 don't place a new trade. Or did you mean something else ?
Mafeng:
i still can not understand because l do not understand how to use the that function you gave. thank you
i still can not understand because l do not understand how to use the that function you gave. thank you
OK do it in parts First Check the OrderOpenTime()
Do you know how to check the OrderOpenTime() of an open trade
Do it checking with a loop function the OrdersTotal()
means check all open trades and check also if right symbol() and right magicnumber()
Trie to do that first and show how you do that....
convert it to a bar number using iBarShift() you have to do later....
Ok l will try that and see if it will work. thank you very much.
Mafeng:
Ok l will try that and see if it will work. thank you very much.
Ok l will try that and see if it will work. thank you very much.
Did you click the links I gave and read what was there ? including the examples ?
// Find How many bars ago we entered Market, it must be a market order // returns <0 if error // return 3 means that we entered 3 bars ago, 0 indicate enter was at current bar int BarsSinceEntry(int Ticket) { int oldticket = OrderTicket(); if (OrderSelect(Ticket,SELECT_BY_TICKET)) { if (OrderType()==OP_BUY || OrderType()==OP_SELL) { for (int i=0;i<1000;i++) { if (OrderOpenTime()>=Time[i] && OrderOpenTime()<Time[i]+Period()*60) { OrderSelect(oldticket,SELECT_BY_TICKET); return (i); } } } else { OrderSelect(oldticket,SELECT_BY_TICKET); return(-2); } } else { // problem OrderSelect(oldticket,SELECT_BY_TICKET); return(-1); } }
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