Please confirm if I am right or correct me if I am wrong:
If I use this function like this:
Will it show me(assign to the var NumberofBars) the number of bars that have been created since the time my order has been opened? ( i run it in the OrdeSelect loop)
Because from the functions' description its not so clear, and do I need to specify "exact" at the end and what does it mean.
exact == false: if your OrderOpenTime() is contained within the time/duration of a bar then that bar number will be returned, if not the number of the bar nearest the time will be returned.
exact == true: if your OrderOpenTime() is contained within the time/duration of a bar then that bar number will be returned, if not -1 will be returned.
be aware problems have been reported with this function . . .
I never use exact=true. All it does is an additional check:
int iBarShiftTrue(... dt){ int i = iBarShift(NULL, 0, dt, false); // Found bar i if( Time[i] > dt) return(-1); // dt is earlier than max bar on chart. if( Time[i] + Period() * 60 <= dt) return(-1); // dt is between two bars. E.g. weekend. return(i); }
See also iBarShift doesn't match documentation. - MQL4 forum
int NumberofBars = iBarShift(Null,0,OrderOpenTime());
It's NULL not Null
Ok, thanks.
Here is my function :
void AbsoleteOrders() { for(int A=OrdersTotal()-1;A>=0;A--) { if(OrderSelect(A,SELECT_BY_POS,MODE_TRADES) if(OrderMagicNumber()==MagicNumber) if(OrderSymbol()==Symbol()) if(OrderType()==OP_SELLSTOP || OrderType()==OP_BUYSTOP) int BarShift = iBarShift(NULL,0,OrderOpenTime(),false); if(BarShift > 2) OrderDelete(OrderTicket(),CLR_NONE); } }
Ok, thanks.
Here is my function :
Don't you want to know if your OrderDelete() failed ? and if it did fail don't you want to know why ?
if(OrderSelect(A,SELECT_BY_POS,MODE_TRADES)Can you find it....
ffs,, lol i've been looking at it for 2 hours
A few spaces will help you see more clearly sometimes . . .
if( OrderSelect( A,SELECT_BY_POS, MODE_TRADES )
// if(OrderSelect( A,SELECT_BY_POS, MODE_TRADES ) if( OrderSelect(A,SELECT_BY_POS, MODE_TRADES) ) if( GlobalVariableSetOnCondition(TC.GV.Name, LOCK, !LOCK) ){ if(IsAboveDIR( Bid, IfD(trigBuy,trigSell) )){ double DIRtrade = Direction( OrderType() ), return( iHighest(NULL,p, MODE_HIGH, n, iBeg) ); } return( values[iNth] ); return( (b - a)*d > Point_2 );
What I do is alternate the spaces from the inside out
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Please confirm if I am right or correct me if I am wrong:
If I use this function like this: