if (Hour()>=7.30&&Hour()<=18.30) { // ...This won't work as you think it would... Hour() returns an int with possible values 0,1,2,...,23. You can't compare it to 7.30 (which is the double number 7.3) and expect the minutes to be magically considered...
This won't work as you think it would... Hour() returns an int with possible values 0,1,2,...,23. You can't compare it to 7.30 (which is the double number 7.3) and expect the minutes to be magically considered...
Did you try the search?
You are not the first to ask this. Just search the forum.
int start() {//1 bool NewBar() {//2 static datetime lastbar = 0; datetime curbar = Time[0]; if(lastbar!=curbar) {//3 lastbar=curbar; return (true); }//3 else {//4 return(false); }//4 }//2 if(NewBar()) {//5 if (Hour()>=8 && Hour()<=15) if (OrdersTotal()==0) {//6 if(Bid == Open[0]-5*Point) {//7 OrderSend(Symbol(),OP_SELL,Lots,Bid,Slippage,Bid+StopLoss*Point,Bid-TakeProfit*Point,txComment,MagicNumber); }//7 else if(Ask == Open[0]+5*Point) {//8 OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,txComment,MagicNumber); )//8 }//6 }//5 //---- return(0); }
You are not the first to ask this. Just search the forum.
you mean like this ..??? i can't compile that code (there is 5 error) ...where is my mistake??please help me...!!!
you mean like this ..??? i can't compile that code (there is 5 error) ...where is my mistake??please help me...!!!
if(Ask == Open[0]+5*Point)
{//8
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,Ask-StopLoss*Point,Ask+TakeProfit*Point,txComment,MagicNumber);
)//8
for example: block should be closed by character } and not by )
All errors are described by your compiler when you are using MetaEditor for development.
So my advice is to check errors decription returned by compiler.
Folvo
if(Bid == Open[0]-4*Point){ OrderSend(Symbol(), OP_SELL,Lots, Bid, Slippage, Bid+StopLoss*Point, Bid-TakeProfit*Point, 0); }you can not compare doubles with == (except == 0) they will never be EXACTLY equal. you probably want
if(Bid >= Open[0]+5*Point)Also, on a 5 digit broker a Pip is NOT a Point so the above is a 1/2 pip not 5 pips. You must adjust all constants
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init() { if (Digits == 5 || Digits == 3) { // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
anybody help...!!!!