No,

This is still looking into the future, just much slower ;)

By virtue of iterating through *all* bars the first time around, you have 
gathered information about later bars (i.e. the future) that you are then 
making use of during earlier bars the second time around.

It is not possible to do what you are wanting to do, without looking into the 
future.

Mike

--- In [email protected], "booker_1324" <booker_1...@...> wrote:
>
> Hi Mike,
> 
> Does this have any merit? It does not look into the future. It's still a work 
> in progress. Is there anything you would change? Thanks for your help.
> ...
> ...
> ...
> 
> ///////////////////////////////////////////////////
> // Test run to determine value of highs and lows //
> for (bar = 0; bar < BarCount; bar++) {
> if (lookingForHigh) {
> if (bigHigh[bar]) {
> lookingForHigh = False; // now looking for low
> highs++;
> }
> } else {
> if (smallLow[bar]) {
> lookingForHigh = True; // now looking for high
> lows++;
> }
> }
> }
> 
> //////////////////////////////////////////////////
> // Value of highs and lows have been determined //
> for (bar = 0; bar < BarCount; bar++) {
> if (lookingForHigh) {
> if (bigHigh[bar]) {
> lookingForHigh = False; // now looking for low
> PlotText("HH" + highs, bar -1, High[bar] + dist[bar], colorRed);
> highs--;
> }
> } else {
> if (smallLow[bar]) {
> lookingForHigh = True; // now looking for high
> PlotText("LL" + lows, bar -1, Low[bar] - dist[bar], colorGreen);
> lows--;
> }
> }
> }
> 
> 
> --- In [email protected], "Mike" <sfclimbers@> wrote:
> >
> > Only if you're willing to look into the future, and as new values develop 
> > on the right of the graph, those values already printed will change.
> > 
> > highs = LastValue(Cum(bigHigh));
> > 
> >     ...
> >     if (bigHigh[bar]) {
> >       lookingForHigh = false; // now looking for low
> >       PlotText("HH" + highs, bar, High[bar], colorGreen);
> >       highs--;
> >     }
> >     ...
> > 
> > Mike
> > 
> > --- In [email protected], "booker_1324" <booker_1324@> wrote:
> > >
> > > Mike, just one more question. The labels from left to right are LL1, LL2, 
> > > LL3 and so on. Is there a way for the labels to be reversed to read from 
> > > the right to left starting with LL1 and HH1? 
> > > 
> > > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > > >
> > > > Sure, just initialize a variable to track the number of highs then use  
> > > > PlotText to write out the count. Do the same for lows.
> > > > 
> > > > e.g. (untested)
> > > > 
> > > > highs = 1;
> > > > 
> > > >     ...
> > > >     if (bigHigh[bar]) {
> > > >       lookingForHigh = false; // now looking for low
> > > >       PlotText("HH" + highs, bar, High[bar], colorGreen);
> > > >       highs++;
> > > >     }
> > > >     ...
> > > > 
> > > > Mike
> > > > 
> > > > --- In [email protected], "booker_1324" <booker_1324@> wrote:
> > > > >
> > > > > Nice code Mike, to take this a step farther, is it posible to attach 
> > > > > a label to each HHV and LLV such as HH1, HH2, HH3, LL1, LL2, and LL3 
> > > > > without referencing future quotes?
> > > > > 
> > > > > --- In [email protected], "Mike" <sfclimbers@> wrote:
> > > > > >
> > > > > > What makes you think that you are changing the step size? From what 
> > > > > > I see, you're still advancing a single bar at a time.
> > > > > > 
> > > > > > bigHigh = high >Ref (hhv(high,50),-1);
> > > > > > smallLow = low < Ref (llv(low,50),-1);
> > > > > > lookingForHigh = true;
> > > > > > 
> > > > > > for (bar = 0; bar < BarCount; bar++) {
> > > > > >   if (lookingForHigh) {
> > > > > >     if (bigHigh[bar]) {
> > > > > >       lookingForHigh = false; // now looking for low
> > > > > >     }
> > > > > >   } else {
> > > > > >     if (smallLow[bar]) {
> > > > > >       lookingForHigh = true;
> > > > > >     }
> > > > > >   }
> > > > > > }
> > > > > > 
> > > > > > Mike
> > > > > > 
> > > > > > --- In [email protected], "Markus Witzler" <funnybiz@> 
> > > > > > wrote:
> > > > > > >
> > > > > > > Hello,
> > > > > > > 
> > > > > > > I wonder if I can step thru a loop where the step size is being 
> > > > > > > computed WITHIN the loop.
> > > > > > > 
> > > > > > > An example:
> > > > > > > 
> > > > > > > I want the loop to check for every bar until high >Ref 
> > > > > > > (hhv(high,50),-1).
> > > > > > > 
> > > > > > > From THAT bar on, the loop should check if low < Ref 
> > > > > > > (llv(low,50),-1) occured.
> > > > > > > 
> > > > > > > Say, the first condition is true on bar 50, the loop should 
> > > > > > > afterwards start to check for the second ccondition from bar 51 
> > > > > > > until that condition is fullfilled, say on bar 80.
> > > > > > >  
> > > > > > > From THAT bar on, it again should check for the first condition 
> > > > > > > etc.
> > > > > > > 
> > > > > > > The thing is that I can“t tell the loop the step size in ADVANCE 
> > > > > > > and it may differ over the whole data range, depending on WHEN 
> > > > > > > the condition beign checked for is true.
> > > > > > > 
> > > > > > > Any ideas on this?
> > > > > > > 
> > > > > > > Thanks
> > > > > > > 
> > > > > > > Markus
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>


Reply via email to