bonechair:
This function of mine does not seem to work, I need help with this.
I want to match with magicnumber and see if same order has opened before
/** Scan History **/ bool InHistory(double magic) <-Magic should be integer not double { int i,hstTotal=OrdersHistoryTotal(); for(i=0;i<hstTotal;i++) { OrderSelect(i, SELECT_BY_POS, MODE_HISTORY);<-Put this within an if() statement if(OrderMagicNumber() == magic) { return(TRUE); break;<-The break is useless because it'll return above. } else {<-One way or the other, its going to return true or false on the first check. return(FALSE);<-Therefore if the 1st in history doesn't match the magic it returns false } } }
/** Scan History **/ bool InHistory(double magic) { int i,hstTotal=OrdersHistoryTotal(); for(i=0;i<hstTotal;i++) { OrderSelect(i, SELECT_BY_POS, MODE_HISTORY); if(OrderMagicNumber() == magic) { return(TRUE); } } return(FALSE) //MOVED THIS RETURN TO OUTSIDE THE LOOP }
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
/** Scan History **/ bool InHistory(double magic) { int i,hstTotal=OrdersHistoryTotal(); for(i=0;i<hstTotal;i++) { OrderSelect(i, SELECT_BY_POS, MODE_HISTORY); if(OrderMagicNumber() == magic) { return(TRUE); break; } else { return(FALSE); } } }
This function of mine does not seem to work, I need help with this.
I want to match with magicnumber and see if same order has opened before