PureBytes Links
Trading Reference Links
|
Don,
Cond=H>Ref(H,-1);
Val=ValueWhen(Cond,H,1);
Graph0=Val;
graph0 holds the value of H till next occurrence of
the same condition, where will hold the next value
and so on
Dimitris Tsokakis
--- In amibroker@xxxx, "doeddoed2002" <doed@xxxx> wrote:
> Hi,
> I appologise that my previous example may have been misleading
> because the valuewhen() statement looks as if it could do the job.
>
> I wont bore you with all the reasons but one problem is that the
> second value may be coincidentally the same as the first and I
still
> need to know that its related to a new condition. I dont have a
> second array to use in FLIP(). The condition is only 1 on the day
it
> occurs and reverts to 0 for other days.
>
> Tomasz's FLIP()example would be fine if it worked on one array but
> not two eg
>
> array1 000000010000100000
> result 000000011111000000
>
> Using cum()can work in some cases but not for my purpose because I
> want to reset to 0 or 1 each time condition occurs.
> result 00000001111122222222333
>
>
>
>
> --- In amibroker@xxxx, "farriners2002" <dre@xxxx> wrote:
> > Hi,
> > Just returned to find all those great suggestions which I will
work
> on. many thanks for all the help.
> >
> > I looked at flip(array1,array2) but in my case I want it to work
> with the same array not a different one.ie I want to hold a value
> from the first occurence until the second occurence of the same
> condition.
>
>
>
> >
> > eg
> >
> > Cond=high>ref(high,-1); /* the condition being monitored is high
> today greater than high yesterday */
> > val=valuewhen(cond,high,1); /* the value of high when condition
> occurs */
> > then something like flip(cond,cond); or holdtill(cond,val); /* a
> way to keep the last value of high constant until the condition
> occurs again, then change to the new value and hold again until etc
*/
> >
> > Maybe I'm missing an obvious way to do this.
> > Ps to the person who suggested I learn AFL, this is what I am
> trying to do with all your help.
> > Regards Don.
|