new order each hour - page 2

 
start(){
  static Hour.previous; if (Hour() != Hour.previous) { Hour.previous = Hour();
     //once per hour here
  }

if (
     (Hour() ==0 || Hour()==1 || Hour()==2 || Hour()==3 || Hour()==4 || Hour()==5 || Hour()==6
 ...
That is ALWAYS true for EVERY tick.
 
SanMiguel:

Does Open[0] only fire once at the start of the new hour candle?


Still not sure why the order isn't being sent here even though the code is fired:

Greetings,

I *Really HATE jumping into the middle of replys, and it looks like ubzen: has the answer figured out already.

Two points came-up in my mind;

((1) Rather than so many HOURS == ( except for testing) I would place the numeric hours (0 1,2,3,4,23) into a string ( 1-D array)

Hour()==8 || Hour()==9 ||

...(2)

The Time_Stamp "Looked" ! like a problem. I Think the TimeStamp returns yy dd hh mm ss ( and maybe more ie 1/10 seconds)

so comparing 18 hours to 18:37:58 "May", not always match, you 'may' have to truncate or filter the TimeStamp a little.

TimeStamp(hh) == 18


TimeStamp(hh) == timeArray(hourcntr);

++hourcntr;

if (hourcntr>=23){hourcntr=0;} // rem this script 'may' be OFF by 1.


Anyway - Just a thought this morning.

 
SanMiguel:

Yes, but if the order failed it would show up as an error in the journal/Experts log wouldn't it?

Maybe 'Yes.' - Perhaps.

Try a more simple statement.

   OrderSend(Symbol(),OP_BUYLIMIT, Lots, NormalizeDouble(varLow,2), 0, NULL, NULL, NULL, 0); //TP and SL are put in by the manage code
              

// OrderSend(Symbol(),OP_BUYLIMIT, Lots, Ask,Slip,sl,tp,"nothing',1024,0,pokaDot);


Something like this...

OrderSend(Symbol(),OP_BUYLIMIT, Lots, Ask,0,0,0);

My point being... The ORDER may, in-fact, be being sent to the server, but the Server rejects it over some technicality.

This creates no 'error' and also does not produce an Order. - Similar to what you have now.


My suggestion, for testing, is to use hard-coded values ("Which are EASILY recognised, ie not 1,0,null, and not STD defaults)

and then verify that those EXACT values are being met or changed correctly as the app runs.

good luck.


ps ( not really sure about the no 'err' part )

 
MXVC.VII.LCXVI:

Greetings,

I *Really HATE jumping into the middle of replys, and it looks like ubzen: has the answer figured out already.

Two points came-up in my mind;

((1) Rather than so many HOURS == ( except for testing) I would place the numeric hours (0 1,2,3,4,23) into a string ( 1-D array)

...(2)

The Time_Stamp "Looked" ! like a problem. I Think the TimeStamp returns yy dd hh mm ss ( and maybe more ie 1/10 seconds)

so comparing 18 hours to 18:37:58 "May", not always match, you 'may' have to truncate or filter the TimeStamp a little.

TimeStamp(hh) == 18


TimeStamp(hh) == timeArray(hourcntr);

++hourcntr;

if (hourcntr>=23){hourcntr=0;} // rem this script 'may' be OFF by 1.


Anyway - Just a thought this morning.



ps The int HOUR() function is, in fact correct - FYI you can ref to CloudBreakers listing of ALLfunctions which he was gracious enough to post.

 
WHRoeder:

That is ALWAYS true for EVERY tick.

Your if statement should look like this. You need to add the Hours 7 - 24

if ((Hour()==0 || Hour()==1 || Hour()==2 || Hour()==3 || Hour()==4 || Hour()==5 || Hour()==6 ...) && Minute()==0 && Seconds()==0)

 
phillw:

Your if statement should look like this. You need to add the Hours 7 - 24

if ((Hour()==0 || Hour()==1 || Hour()==2 || Hour()==3 || Hour()==4 || Hour()==5 || Hour()==6 ...) && Minute()==0 && Seconds()==0)


First this is a very old topic last post was from 2010.....

Second phillw you are wrong we don't have every second new tick so your code is failing

start(){
  static Hour.previous; if (Hour() != Hour.previous) { Hour.previous = Hour();
     //once per hour here
  }

WHRoeder has given this correct solution the OrderSend function can be placed where you read

//once per hour here

Reason: