Count bars since ... ... - page 2

 
William Roeder #:

bars=iBarShift(time)

Dear William Roeder . You are very vague...not helping...  either you dont know or you dont understand... 


This is the definition of iBarsShift right ?  :  "Search for a bar by its time. The function returns the index of the bar which covers the specified time. "

TIME is the key word there.... I dont know the time...I dont know when particular event is happening... that is what I want to find out first...and after I have the TIME of the event, I can start counting with iBarsShift   ... or ibarsshift will indicate the index of that bar coresponding with the event I am looking for.


I think you understood exactly what I meant... I understand that you guys are making money from coding so I'm willing to pay for that info if necessary.





 
Daniel Cioca #: . I dont know the time...
   if (sig==tsi)
     {
      time=iTime(_Symbol,0,1);

  1. You saved it.
  2. Your title asked how to count.
 
William Roeder #:
  1. You saved it.
  2. Your title asked how to count.

How about this...


datetime time;
  if( NormalizeDouble(sig,0)==NormalizeDouble(tsi,0));
   {
   datetime time=iTime(_Symbol,0,1);
   }
   int bars=iBarShift(_Symbol,0,time,true);
// Open buy order
   if( Count.Buy()<1&& tsi>sig && bars<5 && gBuyTicket ==0 )
Reason: