Params must be outside 'if'

Topics about the AmiBroker platform
trash
Posts: 30
Joined: Fri Mar 30, 2012 9:15 pm
Contact:

Params must be outside 'if'

Postby trash » Sat Aug 18, 2012 10:53 pm

Hello,

Any Param* function MUST NOT be called conditionally (inside 'if').
So your ParamToggle must be OUTSIDE 'if' (at global level), like this:


Code: Select all

toggle = ParamToggle( "Shape On Price ", "NO|YES", 0 );
TriCirShape = ParamToggle( "Hit Prices Shape ", "Triangle|Circle", 0 );

if( toggle )
{
   if ( TriCirShape == 0 )
   {
      PlotShapes( IIf( Buy, shapeSmallUpTriangle, shapeNone ), colorWhite  0, BuyPrice, 0 );
      PlotShapes( IIf( Sell, shapeSmallDownTriangle, shapeNone ), colorPink, 0, SellPrice, 0 );
      PlotShapes( IIf( Short, shapeHollowDownTriangle, shapeNone ), colorYellow, 0, ShortPrice, 0 );
      PlotShapes( IIf( Cover, shapeHollowUpTriangle, shapeNone ), colorAqua, 0, CoverPrice, 0 );
   }
   else
   {
      PlotShapes ( IIf ( Buy , shapeSmallCircle , shapeNone ), colorWhite, 0, BuyPrice , 0 );
      PlotShapes ( IIf ( Sell , shapeSmallCircle , shapeNone ), colorPink, 0, SellPrice , 0 );
      PlotShapes ( IIf ( Short , shapeHollowCircle , shapeNone ), colorYellow, 0, ShortPrice , 0 );
      PlotShapes ( IIf ( Cover , shapeHollowCircle , shapeNone ), colorAqua, 0, CoverPrice , 0 );
   }
}


Best regards,
Tomasz Janeczko
amibroker.com


http://finance.groups.yahoo.com/group/a ... age/166841

Return to “AmiBroker Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest