Help with Paramlist and Plotshapes

Hi,
firstly I thank all of you, Glad to be in this forum and learn a lot from this forum,

I am new to amibroker AFL
I am exploring paramlist and would like to use it with Plotshapes


Plot(C,"Price", IIf(C> Ref(C,-1),colorGreen,colorRed), styleCandle );  

O1 = Ref(O,-1);O2 = Ref(O,-2);
H1 = Ref(H,-1);H2 = Ref(H,-2);
L1 = Ref(L,-1);L2 = Ref(L,-2);
C1 = Ref(C,-1);C2 = Ref(C,-2);
whiteBody=C>O;
blackBody=O>C;

Hammer = (((H-L)>3*(O-C)) AND ((C-L)/(.001+H-L)>0.6) AND ((O-L)/(.001+H-L)>0.6));
ShootingStar = (((H-L)>4*(O-C)) AND ((H-C)/(.001+H-L)>= 0.75) AND ((H-O)/(.001+H-L)>= 0.75));
ThreeOutsideDownPattern = ((C2>O2) AND (O1>C1) AND (O1>= C2) AND (O2>= C1) AND ((O1-C1)>(C2-O2)) AND (O>C) AND (C<C1)); 


 CandleList = "Hammer,ShootingStar,ThreeOutsideDownPattern";
 CandleDisplay = ParamList("Show What Candle ?",CandleList);
 
 //this line run well
 //PlotShapes(ShootingStar*shapeStar,colorred,Layer=0,yposition=H,Offset=37); 
 
 //This line is I want,  that only show candle pattern which I choose
 //but produce "Error 1. Operation not allowed. Operator/operand type mismatch"
 PlotShapes(CandleDisplay*shapeStar,colorred,Layer=0,yposition=H,Offset=37);  
 
 Title = FullName()+"\n"+ Date() +StrFormat(" - Open %g, Hi %g, Lo %g, Close %g " , O,H,L,C )+"Volume : " + V +
 "\n"+ "Candlestick : "+ candledisplay ;
 

the error is
"Error 1. Operation not allowed. Operator/operand type mismatch"

Please help me with this one, Thank you

Hi,
You are confusing the name of a variable (a string) with the numeric content of a variable. Use VarGet() function to fetch the content.

PlotShapes(VarGet(CandleDisplay)*shapeStar,colorred,Layer=0,yposition=H,Offset=37); 
4 Likes

Thank you JohnHT for the answer.
It works like a charm !!

Now plotshapes is connected with Paramlist

1 Like

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.