English

## Running For Loop Bar wise?

 171 cashcube 2015.07.07 06:25   I have seen for loop here works tick wise. How to run the loop bar wise? I want to add +1 pip from the low in per bar in 1 minute chart. I am creating Gann 1x1 Angles, where for each bar angle will rise +1 pip upto 120 bars. ```if( LowT < HighT)  // If low formed first {      datetime i;      for( i = LowT; i < (LowT + (7200)); i++) // Time counting for next 2 hours      {                for (int k = 0; k <120; k++)            {                A = low + ((double)k * CalcPoint); // Adding 0.0001 with k                printf(StringConcatenate("Low angle = ",DoubleToString(A,5)));            }      } }``` Now in above code, "k" is basically adding +1 absolutely ok but not per bar wise, per tick wise. So I am getting wrong data.  Cause after 120 tick it again going into the loop.How to run the loop bar wise? I want to store 1x1 angle data for 80 bar from that LowT time & low. Do I have to introduce array? Thank you
 13116 WHRoeder 2015.07.07 14:12 #   I have no idea what you are trying to say. It sounds like babble.`for( i = LowT; i < (LowT + (7200)); i++)`if LowT is a datetime, as is i, you are incrementing time. If you want to find which bar corresponds to a time, use iBarShift
 171 cashcube 2015.07.07 15:49 #   WHRoeder: I have no idea what you are trying to say. It sounds like babble.if LowT is a datetime, as is i, you are incrementing time. If you want to find which bar corresponds to a time, use iBarShiftSorry to put it in that way. Here I explain with examples.Suppose I draw Gann angle 1x1 from 50 which is a low. Now According to the Angle methods, it grows 1 pip per unit of time (i.e current chart bar). In following way. Angle [0]  = 50 at T timeAngle [1] = 51 at T1 timeAngle [2] = 52 at T3  time. ...... upto Angle [120] Now I need to store this data & compare with "Ask" price, so every time "Ask" = "Angle[i]" , I buy. Now with above code I try to calculate angle levels. But " for" loop is adding +1 with the low with each tick, not with each current bar.
 13116 WHRoeder 2015.07.07 20:20 #   You know the low (50) you know the bar index iBarShift(... T ) You know the current bar index (0) Therefor you know the "Angle" = 50 + iBarShift * pip. No loops, no arrays.
 171 cashcube 2015.07.08 07:40 #   WHRoeder: You know the low (50) you know the bar index iBarShift(... T ) You know the current bar index (0) Therefor you know the "Angle" = 50 + iBarShift * pip. No loops, no arrays.Thank you so much! It worked with less headache...