PureBytes Links
Trading Reference Links
|
I have not tried running this code, but you could do something like this:
R = H-L;
C1past = Ref(C, -1);
H1past = Ref(H, -1);
L1past = Ref(L, -1);
R1past = Ref(R, -1);
C1future = Ref(C, 1);
H1future = Ref(H, 1);
L1future = Ref(L, 1);
R1future = Ref(R, 1);
subcondition1 = C > C1past;
subcondition2 = H > H1past;
subcondition4 = L > L1past;
subcondition8 = R > R1past;
subcondition16 = C > C1future;
subcondition32 = H > H1future;
subcondition64 = L > L1future;
subcondition128 = R > R1future;
for (cond = 0; cond < 256; cond++)
{
printf("Condition%.0f = ", cond);
if ((cond & 1) == 1) printf("subcondition1 AND "); else
printf("NOT subcondition1 AND ")
if ((cond & 2) == 2) printf("subcondition2 AND "); else
printf("NOT subcondition2 AND ");
if ((cond & 4) == 4) printf("subcondition4 AND "); else
printf("NOT subcondition4 AND ");
if ((cond & 8) == 8) printf("subcondition8 AND "); else
printf("NOT subcondition8 AND ");
if ((cond & 16) == 16) printf("subcondition16 AND "); else
printf("NOT subcondition16 AND ");
if ((cond & 32) == 32) printf("subcondition32 AND "); else
printf("NOT subcondition32 AND ");
if ((cond & 64) == 64) printf("subcondition64 AND "); else
printf("NOT subcondition64 AND ");
if ((cond & 128) == 128) printf("subcondition128"); else printf("NOT
subcondition128");
printf("\n");
}
--- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@xxx> wrote:
>
> How would you do that Steve...? Any pointers...?
> Is there a link you can point me to...?
>
> TIA
>
> --- In amibroker@xxxxxxxxxxxxxxx, "Steve Davis" <_sdavis@> wrote:
> >
> > If your conditions can be enumerated in a systematic way, you could
> > write a code generator to emit the code automatically. This would work
> > well if you wanted condition arrays for every possible combination of
> > several subconditions. If you had 8 subconditions, it would be fairly
> > easy to emit the afl for the 256 combinations of those subconditions.
> >
> > -Steve
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "sidhartha70" <sidhartha70@> wrote:
> > >
> > > A little bit of code advice if I can... I have a very large
number of
> > > conditional statements that I am intending to use to draw indicators
> > > on various bars...
> > > The conditional statements can be quite complex, but they are
all of a
> > > similar form to the following which I include as an example,
> > >
> > > Condition1=H>Ref(H,-1) AND L>=Ref(L,-1) AND (H-L)>Ref((H-L),-1) AND
> > > C==O AND C>Ref(C,1) AND H>=Ref(H,1) AND V<Ref(V,-1) AND V<Ref(V,-2);
> > > Condition2=...
> > > .
> > > .
> > > .
> > > .
> > > Condition200=
> > >
> > >
> > > So I am talking a lot of conditional statements.
> > >
> > > I then want to both use PlotShapes() to signify when a condition is
> > > true on the chart and Printf() to print the exact form of true
> > > condition to the interpretation window... e.g.
> > >
> > > if(SelectedValue(Condition1)) printf("COND1\n");
> > > if(SelectedValue(Condition2)) printf("COND2\n");
> > > .
> > > .
> > > .
> > > .
> > > if(SelectedValue(Condition200)) printf("COND200\n");
> > >
> > > PlotShapes(Condition1 * shapeSmallDownTriangle,colorGold,0,H);
> > > PlotShapes(Condition2 * shapeSmallUpTriangle,colorGold,0,L);
> > > .
> > > .
> > > .
> > > PlotShapes(Condition200 * shapeSmallUpTriangle,colorGold,0,L);
> > >
> > > etc...etc...
> > >
> > > Obviously this requires many many lines of code... I've been
thinking
> > > there has to be a more efficient way of coding something like this.
> > > Any thoughts you can throw my way...?
> > >
> > > Many Thanks
> > >
> >
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|