Rounding numeric expressions in Market Scanner  [SOLVED]

Questions about MultiCharts and user contributed studies.
Louis88
Posts: 24
Joined: 11 May 2013
Has thanked: 28 times
Been thanked: 1 time

Rounding numeric expressions in Market Scanner

Postby Louis88 » 28 Sep 2013

Hi everybody,
I didn't find any previous post on the subject.
If there is any, please consider my apologies.

I've added the following numeric expressions to Market Scanner:

Code: Select all

//-----------------------------------------------------------------
Vars: NetChng(0), ChngPct(0), IndClose(0), Rou(3);
NetChng = (Close - Close[1]);
ChngPct = Round(100 * (Close - Close[1]) / Close[1], Rou);
IndClose = Round(100 * (Close / Avg(Close, 50)), Rou);

Plot1(Round(Open, Rou),"Open");
SetPlotColor( 1, white ) ;

Plot2(Round(High, Rou),"High");
SetPlotColor( 2, white ) ;

Plot3(Round(Low, Rou),"Low");
SetPlotColor( 3, white ) ;


IF Close > Close[1]
THEN BEGIN
SetPlotColor( 4, green );
SetPlotColor( 5, green );
SetPlotColor( 6, green );
END;
IF Close < Close[1]
THEN BEGIN
SetPlotColor( 4, red );
SetPlotColor( 5, red );
SetPlotColor( 6, red );
END;

IF Close = Close[1]
THEN BEGIN
SetPlotColor( 4, white );
SetPlotColor( 5, white );
SetPlotColor( 6, white );
END;

Plot4(Round(Close, Rou),"Close");
Plot5(Round(NetChng, Rou),"Net change");
Plot6(Round(ChngPct, Rou),"Chng %");

SetPlotColor( 7, white ) ;
Plot7(Round(Volume, Rou),"Volume");

IF IndClose > 100
THEN
SetPlotColor( 8, green ) ;
IF IndClose < 100
THEN
SetPlotColor( 8, red ) ;
IF IndClose = 100
THEN
SetPlotColor( 8, white ) ;
Plot8(Round(IndClose, Rou),"Indice Close");
// ---------------------------------------------------
but with this code can't set the decimal places [var Rou(3)].

The Market Scanner always show 5 decimal places.
What is wrong with this code ?

Many Thanks
Louis

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Rounding numeric expressions in Market Scanner

Postby TJ » 28 Sep 2013

how to post codes
viewtopic.php?f=16&t=11713

User avatar
TJ
Posts: 7740
Joined: 29 Aug 2006
Location: Global Citizen
Has thanked: 1033 times
Been thanked: 2221 times

Re: Rounding numeric expressions in Market Scanner  [SOLVED]

Postby TJ » 28 Sep 2013

go to the scanner window,

right click on any of the fields under the study,
a list will drop down,
select "Format xxx Study for All Instruments".

a window will pop up,

Look under "Properties" tab,
you can change the "Number Format" to any decimals you prefer.

Louis88
Posts: 24
Joined: 11 May 2013
Has thanked: 28 times
Been thanked: 1 time

Re: Rounding numeric expressions in Market Scanner

Postby Louis88 » 29 Sep 2013

Many Thanks
Louis


Return to “MultiCharts”