How to use place a trade at the beginning of every second (regardless of price)?

 

How to use place an order at the beginning of every second (regardless of price)?

Sound simple? But I just cannot figure out how to do it?

Should I use date and time functions?

How?


Thanks in advance!

 

if u put the EA on 1H TF chart

if (Fun_New_Bar())
   {
   OrderSend(......);
   }
bool Fun_New_Bar()
   {
   static datetime New_Time = 0;
   bool New_Bar = false;
   if (New_Time!= Time[0])
      {
      New_Time = Time[0];
      New_Bar = true;
      }
   return(New_Bar);
   }

if u don't use 1H TF chart then:

if (Fun_New_Bar())
   {
   OrderSend(......);
   }
bool Fun_New_Bar()
   {
   static datetime New_Time = 0;
   bool New_Bar = false;
   if (New_Time!= iTime(NULL,PERIOD_H1,0))
      {
      New_Time = iTime(NULL,PERIOD_H1,0);
      New_Bar = true;
      }
   return(New_Bar);
   }
 
qjol:

if u put the EA on 1H TF chart

if u don't use 1H TF chart then:


Thanks, let says I would like to place an order say every second? How?

There are no 1 sec chart or PERIOD_S1 ???

Is it possible? Maybe by using the date and time functions?

 
OrderSend(....);
without any condition is gonna open every tick
 
qjol:
without any condition is gonna open every tick

instead of every tick, how to go about for every second?
 

can u explain please what u r trying to accomplish

 
qjol:

can u explain please what u r trying to accomplish


want to see mt4 place an order every second? Any idea how to code?
 
int i = 1;
while (i != 0)
   {
   OrderSend(....);
   Sleep(1000);
   }