int start() { // // // // checking OrderSend bool check; check = checkMA(); if (check==true) return(true); if (check==false) return(false); // All the above 6 lines can be replaced with simply return(checkMA()) return(INIT_SUCCEEDED); }
Tidy your code up, it looks like a lot of cut and pastes
start() returns an integer, so why are you returning either a bool or INIT_SUCCEEDED
if ( (Hour()== 0 || Hour()== 1 || Hour()== 2 || Hour()== 3 || Hour()== 4 || Hour()== 5 || Hour()== 6 || Hour()== 7 || Hour()== 8 || Hour()== 9 || Hour()== 10 || Hour()== 11 || Hour()== 12 || Hour()== 13 || Hour()== 14 || Hour()== 15 || Hour()== 16 || Hour()== 17 || Hour()== 18 || Hour()== 19 || Hour()== 20 || Hour()== 21 || Hour()== 22 || Hour()== 23 ) && (Minute()==0) && (Seconds()==0) )
You've covered every possible Hour, so what's the point?
It is exactly the same as
if (Minute()==0) && Seconds()==0) )
That means that if there is not an incoming tick in the first second of the hour, the code will not be executed
Tidy your code up, it looks like a lot of cut and pastes
start() returns an integer, so why are you returning either a bool or INIT_SUCCEEDED
What do you suggest me to do so if start() returns an integer ?
You've covered every possible Hour, so what's the point?
It is exactly the same as
That means that if there is not an incoming tick in the first second of the hour, the code will not be executed
My point is to open order on every hour.
Is it possible to make the code executed in the first second of the hours even though there is no tick at that time ?
As there is little or no apparent logic to your code, it is difficult to offer any advice.
static int static_hour=Hour(); if(static_hour!=Hour()) { static_hour=Hour() //New Hour so can check for a new trade condition }
will execute code only on the first tick of a new hour
As there is little or no apparent logic to your code, it is difficult to offer any advice.
will execute code only on the first tick of a new hour
You have already replied my question.
I appreciate it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
Could you please help me why my orders are opened more than 0.1 on every hour as I would like to have actually ? Plus, the codes do not open order on every hour sometimes. Why do you think this happens ?
Thank you.