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

[amibroker] Re: 1 Bad color on 2


  • Date: Sun, 22 Nov 2009 05:35:34 -0000
  • From: "Mike" <sfclimbers@xxxxxxxxx>
  • Subject: [amibroker] Re: 1 Bad color on 2

PureBytes Links

Trading Reference Links

Yves,

Look more closely at your code. Specifically;

uptrend= IIf(Result,1,0) ;
downtrend= IIf(Result,1,0) ;

Notice that you have set uptrend and downtrend to the exact same value. Now looking at your IIf statement;

IIf( uptrend, colorViolet, IIf( downtrend, colorWhite, 0 ))

You are saying if uptrend use colorViolet, otherwise if downtrend use colorWhite, otherwise use 0.

Since uptrend and downtrend are set to the same value, whenever it is not uptrend it will not be downtrend either, and the result will therefore be 0.

Similarlly, anytime it is uptrend, it will also be downtrend. But, colorViolet will win since the 'true' branch gets first chance.

While you're fixing that, consider that the statement is unnecessary. There is no reason to say:

IIf(Result,1,0)

just say uptrend = Result;

Any non zero value is true. Whether Result holds a 5, a 1, or any other non zero value, they are all true. It is pointless to waste processing time converting the values to 1 unless you specifically need to use the values in some other mathematical equation.

Also, Haut will always be greater than Bas, so saying:

Ind[ i ] > Haut[ i ] AND Ind[ i ] > Bas[ i ]

is redundent. Just use:

Ind[ i ] > Haut[ i ].


Mike


--- In amibroker@xxxxxxxxxxxxxxx, Yves <yltech@xxx> wrote:
>
> 
> I Know that
> But I'm write: VIOLET and WHITE
> and I'Mm obtai VIOLET and BLACK
> WHY?
> 
> 
> Merci
>  
> YLTech ( Yves L. )
>  
> Le présent message et les documents qui y sont joints sont réservés exclusivement au destinataire indiqué. Il est strictement interdit d'en utiliser ou d'en divulguer le contenu. Si vous recevez le présent message par erreur, veuillez le détruire S.V.P. et nous en aviser immédiatement afin que nous puissions corriger nos dossiers. Merci.
>  
> This message and the attached documents may contain privileged or confidential information that are intended to the addressee only. Any unauthorized disclosure is strictly prohibited. If you happen to receive this message by error, please delete it and notify us immediately so that we may correct our internal records. Thank you.
>  
> yltech@xxx
> 
>   ----- Original Message ----- 
>   From: Rick Osborn 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Friday, November 20, 2009 11:40 PM
>   Subject: Re: [amibroker] 1 Bad color on 2
> 
> 
>     
> 
>   also, "result" in the for loop returns only 2 values - 5 or 0.
>   therefore, you will only get 2 colors in the ribbon.
> 
> 
> 
> 
> ------------------------------------------------------------------------------
>   From: NW Trader <ta4charts@xxx>
>   To: amibroker@xxxxxxxxxxxxxxx
>   Sent: Fri, November 20, 2009 7:46:01 PM
>   Subject: Re: [amibroker] 1 Bad color on 2
> 
>     
> 
>   Hi Yves,
> 
>   Your IIF statement is not properly constructed (missing an argument).  Here's the solution - 
> 
>   Plot( 1.5, "Tr-RSI", 
> 
>   IIf(uptrend, colorviolet,IIf(downtrend, colorwhite,colordefault ) ) ,
> 
>   styleOwnScale|styleArea|styleNoLabel|styleNoTitle , -0.5, 100 ) ;
> 
>    
>   Peace and Justice   ---   Patrick
>     ----- Original Message ----- 
>     From: Yves 
>     To: amibroker@xxxxxxxxx ps.com 
>     Sent: Friday, November 20, 2009 3:01 PM
>     Subject: [amibroker] 1 Bad color on 2
> 
> 
>     The formula Below supposed give to me 2 color, Violet and White
>     Why I't give to me the Violet and BLACK ??????
> 
>     Thank
> 
> ----------------------------------------------------------------------------
> 
>     _SECTION_BEGIN("Tr-RSI");
>     SetChartOptions(0,0,chartGrid30| chartGrid70) ;
> 
>     periods = Param( "Periods", 9, 1, 200, 1 );
> 
>     Ind=RSI(9) ;
> 
>     Haut=60 ;
> 
>     Bas=40 ;
> 
>     Result = 0; 
> 
>     for( i = 1; i < BarCount; i++ )
> 
>     { 
> 
>     prev = result[ i - 1]; 
> 
>     result[ i ] = IIf( Ind[ i ] > Haut[ i ] AND Ind[ i ] > Bas[ i ], 5, 
> 
>     IIf( Ind[ i ] < Bas[ i ], 0, prev ) ); 
> 
>     } ;
> 
>     uptrend= IIf(Result,1,0) ;
> 
>     downtrend= IIf(Result,1,0) ;
> 
>     Plot( 2, /* defines the height of the ribbon in percent of pane width */"ribbon",
> 
>     IIf( uptrend, colorViolet, IIf( downtrend, colorWhite, 0 )), /* choose color */
> 
>     styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
> 
>     _SECTION_END();
> 
> 
> ----------------------------------------------------------------------------
> 
>     Merci
>      
>     YLTech ( Yves L. )
>      
>     Le présent message et les documents qui y sont joints sont réservés exclusivement au destinataire indiqué. Il est strictement interdit d'en utiliser ou d'en divulguer le contenu. Si vous recevez le présent message par erreur, veuillez le détruire S.V.P. et nous en aviser immédiatement afin que nous puissions corriger nos dossiers. Merci.
>      
>     This message and the attached documents may contain privileged or confidential information that are intended to the addressee only. Any unauthorized disclosure is strictly prohibited. If you happen to receive this message by error, please delete it and notify us immediately so that we may correct our internal records. Thank you.
>      
>     yltech@xxxxxxxxxx ca
>




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

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:
    amibroker-digest@xxxxxxxxxxxxxxx 
    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/