How do I change here Writeif function

I following problem in the column I get only N/A and not bullish in the BBstatusSymbol
Why ? Boll =1 but it doesn´t show me the text bullish
Thanks for any help

Period = 20;
i=0;
Filter = 1;
Symbol = Foreign("846900","Close");
Bollband = BBandTop(Symbol,Period,2);
Boll=Symbol>BBandTop(Symbol,Period,2) AND Ref(Symbol,-1)<Ref(BBandTop(Symbol,Period,2),-1);
Boll2=Symbol<BBandBot(Symbol,Period,2) AND Ref(Symbol,-1)>Ref(BBandBot(Symbol,Period,2),-1);
BBStatusSymbol=WriteIf(Boll,"Bullish","N/A");
BBColorSymbol=IIf(Boll,colorGreen,colorRed);
IIf(Boll2,i+1,i);

AddTextColumn( FullName(), "Full name", 77 , colorDefault, IIf( Close >1, colorLightBlue, colorDefault ) );
AddColumn( Close, "Close", 1.2 );
AddColumn(BOLL,"SIGNAL",1);
AddTextColumn(BBStatusSymbol,"SymbolStretch",1,colorWhite,BBColorSymbol);

Bild

Try this

Period = 20;
i=0;
Filter = 1;
Symbol = Foreign("846900","Close");
Bollband = BBandTop(Symbol,Period,2);
Boll=Symbol>BBandTop(Symbol,Period,2) AND Ref(Symbol,-1)<Ref(BBandTop(Symbol,Period,2),-1);
Boll2=Symbol<BBandBot(Symbol,Period,2) AND Ref(Symbol,-1)>Ref(BBandBot(Symbol,Period,2),-1);
//BBStatusSymbol=WriteIf(Boll,"Bullish","");
BBColorSymbol=IIf(Boll,colorGreen,colorRed);
IIf(Boll2,i+1,i);
AddTextColumn( FullName(), "Full name", 77 , colorDefault, IIf( Close >1, colorLightBlue, colorDefault ) );
AddColumn( Close, "Close", 1.2 );
AddColumn(BOLL,"SIGNAL",1);
//AddTextColumn(BBStatusSymbol,"SymbolStretch",1,colorWhite,BBColorSymbol);
AddMultiTextColumn( Boll, "N/A\nBullish", "SIGNAL", 1, colorWhite, BBColorSymbol, 80 );
2 Likes

@Munichtrader I think it may help if you clarify what the WriteIf function does. WriteIf returns just single string representing current SelectedValue of the EXPRESSION.

Read these,
http://www.amibroker.com/kb/2014/12/22/text-output-in-explorations/

http://www.amibroker.com/guide/afl/writeif.html

Also it is useful for us all to remember the differences between AddMultiTextColumn vs AddTextColumn

https://www.amibroker.com/guide/afl/addtextcolumn.html
https://www.amibroker.com/guide/afl/addmultitextcolumn.html

Good luck.

1 Like
AddColumn(BOLL,"SIGNAL",1);
BBColorSymbol=IIf(Boll,colorGreen,colorRed);    // green or red for the Signal Boll
AddMultiTextColumn( Boll, "N/A", "SymbolStretch" ); // Boll = 0 = N/A or 1 = empty 
//here I am looking for BOLL =1 for a text "BUY" AND "Green" and not empty 

I didn´t get it. I would like to see a text Buy and green if Boll=1

Hi
I think you have to look little bit more carefully on the LAST LINE of awilson code

"N/A\nBullish"

also have a look in here

@awilson

thanks. I managed.:stuck_out_tongue: