English

ibar shift

 12 fastbucks 2014.09.27 15:17   Hi...I was hoping someone would know the answer to what I thought would be obvious  ;-)When I run in an Ea, Test 1 only,   Hrcnttot   increases according to my sendemail details received.  But if I run only test 2 or 3 , Hrcnttot  never changes....  I assume I have misunderstood the ilow shift ... thanks in advance.... // ############ TEST 1 ###########  if( iLow(NULL,PERIOD_H1,0)    > 0.00001 )      {Hrcnttot=Hrcnttot+1;} // ############ TEST 2 ###########  if( iLow(NULL,PERIOD_H1,-2)    > 0.00001 )      {Hrcnttot=Hrcnttot+1;} // ############ TEST  3###########  if( iLow(NULL,PERIOD_H1,-3)    > 0.00001 )      {Hrcnttot=Hrcnttot+1;}
13128
WHRoeder 2014.09.27 15:55 #

fastbucks: I have misunderstood the ilow shift
1.  Play video Please edit your post. For large amounts of code, attach it.

2. Post all the relevant code. What is Hrcnttot? Is it initialized? Is it a static or globally declared?
3. Bar numbers (all shifts) start at zero (currently forming bar) and increase going back in time. What are you passing?
 12 fastbucks 2014.09.28 13:37 #   Hi WH.. double Hrcnttot;  // is globally declared as shown here. I understand all shifts start at zero, and test 1 works fine. it increments  Hrcnttot every tick so the total becomes into the thousands eventually. Tests 1,2&3 are purely tests because I realised shifts -1 -2 -3 etc etc being hourly bars back in time from the current bar zero, were not incrementing.  Hrcnttot represents hour count total in this example and could be used for many purposes..such as counting how many hourly lows in past 3hours or whatever were in a specific price range(determined by other parts of an Ea) I wouldn't be incrementing their...I increment only for this test to try to prove shift -1,-2 etc don't seem to work.The problem is shift 0 increments but all minus shifts such as -1,-2,-3 etc don't increment.....I hope that's a bit clearer. Thanks in advance...
13128
WHRoeder 2014.09.28 13:47 #

 fastbucks: I realised shifts -1 -2 -3 etc etc being hourly bars back in time What part of "start at zero and increasing going back in time" was unclear?
 12 fastbucks 2014.09.30 13:11 #   Hi WH ... to put it another way...if you run this in experts ...test 0 sends an email...but test -1...never does. The only difference I can see is the -1   ....thanks in advance....```//+------------------------------------------------------------------+ //|                                                         test.mq4 | //|EA THAT TESTS IF SHIFT -1 IN TEST -1 PRODUCES A VALUE   fastbucks | //|                                                        fastbucks | //+------------------------------------------------------------------+ #property copyright "fastbucks" #property link      "fastbucks" #property version   "1.00" #property strict````  ````//+------------------------------------------------------------------+ //| Expert initialization function                                   | //+------------------------------------------------------------------+ int OnInit()   { //---``````     // ############ TEST 0  ###########   if( iLow(NULL,PERIOD_H1,0)  > 0.00001 )            {  SendMail("Forex Account : " +AccountName()+ " Details",       "##### TEST 0 #####Date and Time : "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)+" \n"+       "SYMBOL "+ string (Symbol())   +"" );            Sleep(30000)     ;}      // ############ TEST-1  ###########   if( iLow(NULL,PERIOD_H1,-1)  > 0.00001 )            {  SendMail("Forex Account : " +AccountName()+ " Details",       "##### TEST -1 #####Date and Time : "+TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECONDS)+" \n"+       "SYMBOL "+ string (Symbol())   +"" );            Sleep(30000)    ;}    //---    return(INIT_SUCCEEDED);   } //+------------------------------------------------------------------+ //| Expert deinitialization function                                 | //+------------------------------------------------------------------+ void OnDeinit(const int reason)   { //---      } //+------------------------------------------------------------------+ //| Expert tick function                                             | //+------------------------------------------------------------------+ void OnTick()   { //---      } //+------------------------------------------------------------------+ ```
13128
WHRoeder 2014.09.30 18:13 #

 fastbucks: I have misunderstood the ilow shift Bar numbers (all shifts) start at zero (currently forming bar) and increase going back in time. What are you passing? fastbucks: I realised shifts -1 -2 -3 etc etc being hourly bars back in time What part of "start at zero and increasing going back in time" was unclear? fastbucks: test -1...never does. The only difference I can see is the -1 -1 is decreasing from zero - BOGUS