[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Code Advice



PureBytes Links

Trading Reference Links

Sidhartha,

If the basic form of your formulas is the same, you can make functions  
and just pass the variable information.

Another approach is to create a loop that parses a list of parameters  
for each condition.

I have used both approaches, but I prefer the first approach in most  
cases.  It all depends on the details.  When there are a lot of  
structurally common forms, more possibilities for a shorthand  
algorithmic method exists.

BR,
Dennis


On Oct 8, 2008, at 11:32 AM, 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
>
>
>


------------------------------------

**** 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/