Wrong SetplotBGcolor in Scanner

Questions about MultiCharts and user contributed studies.
SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Wrong SetplotBGcolor in Scanner

Postby SP » 11 Jan 2010

I put a lot of functions into a code and plot as one indicator with 14 cells in the scanner. But the setplotbgcolor doesnt plot always right in beta 2.

Somebody else have this problem?

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

Postby TJ » 11 Jan 2010

you can do this simple test...

right after your setplotbgcolor statement,
add a plot statement to display the color name:

eg.

Code: Select all

if condition1 = true then
begin
plot1( value1, "value1");
setplotbgcolor(1, yellow);
plot2( "Yellow" ); {<--- add this plot)
end;
if the color assignment is correct,
you will see the plot2 color name the same as
the bgcolor in plot1 set by the setplotbgcolor statement.

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Postby SP » 11 Jan 2010

TJ, the plot colors change on different conditions in the code, so your static solution wont help.

On the picture on the left side the code was inserted in the morning, on the right side after "Last" it was added at the moment.
On the left side the numbers in the rows are still correct, but the colors are wrong and differ from the rigth side.
So the problem occurs after some bars or if i open a saved workspace with the indicators on.

PS: For the scanner there is no option "Save Image" or "Print" like for the charts.
Last edited by SP on 11 Jan 2010, edited 1 time in total.

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

Postby TJ » 11 Jan 2010

this is not a static solution.

this is a debug test.

You insert this plot statement AFTER EVERY setplotbgcolor statement.

ie. every time you make a bgcolor change,
MC will immediately print the name of the color on the scanner.

so that you can visually identify whether MultiCharts is plotting the color you want.

If the bgcolor and the color name are the same, but not the color you want, then there is a bug in your logic,

If the bgcolor and the color name are NOT the same, then there is a bug in MultiCharts.


.
Last edited by TJ on 11 Jan 2010, edited 1 time in total.

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

Postby TJ » 11 Jan 2010

you can give this a try:

apply this indicator to a fast chart (eg tick chart) so that you can see the changes quickly.

Code: Select all

{---condition1---}
if c > h[1] then
begin
plot1( c, "C");
setplotbgcolor(1, yellow);
plot2( "1=Yellow" );
end
else
{---condition2---}
if c < l[1] then
begin
plot1( c, "C");
setplotbgcolor(1, red);
plot2( "2=red" );
end
else
{---condition3---}
begin
plot1( c, "C");
setplotbgcolor(1, lightgray);
plot2( "3=gray" );
end;

.

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

Postby TJ » 11 Jan 2010

...
PS: For the scanner there is no option "Save Image" or "Print" like for the charts.
you can use this free screen capture program:
one touch of a hot-key captures the screen/window...
it is much faster than the MultiCharts built-in save image function.
http://www.wisdom-soft.com/

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Postby SP » 11 Jan 2010

So i should look like this ?

Code: Select all


Plot2 ( metacounter, "META CB" ,black);

if (metacounter = -8 or metacounter =-7 or metacounter =-6 or metacounter =-5) then SetPlotBGColor (2, Red)
else if (metacounter = -4 or metacounter =-3 or metacounter =-2 ) then SetPlotBGColor (2, Magenta)
else if (metacounter = -1 or metacounter = 0 or metacounter =1 ) then SetPlotBGColor (2, White)
else if (metacounter = 2 or metacounter = 3 or metacounter = 4 ) then SetPlotBGColor (2, Cyan)
else if (metacounter = 5 or metacounter = 6 or metacounter = 7 or metacounter = 8 ) then SetPlotBGColor (2, Green);


Code: Select all

if (metacounter = -8 or metacounter =-7 or metacounter =-6 or metacounter =-5) then Plot3 (" Red")
else if (metacounter = -4 or metacounter =-3 or metacounter =-2 ) then Plot3 (" Magenta")
else if (metacounter = -1 or metacounter = 0 or metacounter =1 ) then Plot3 (" White")
else if (metacounter = 2 or metacounter = 3 or metacounter = 4 ) then Plot3 (" Cyan")
else if (metacounter = 5 or metacounter = 6 or metacounter = 7 or metacounter = 8 ) then Plot3 (" Green");

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Postby SP » 11 Jan 2010

Saw your example a little too late, will give it a try.

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

Postby TJ » 11 Jan 2010

questions regarding your logic:

1. is it possible for metacounter to have fractional value?

2. what happens if metacounter is larger than 8 or smaller than -8?
what color will it display?

SP
Posts: 465
Joined: 06 Feb 2006
Has thanked: 36 times
Been thanked: 286 times

Postby SP » 11 Jan 2010

1. No.
2. It can by default only get values between 8 and -8.

I put the SetPlotBGColor conditions now 2 times before and after every Plot and with your text addition.
It seems that the problem has gone, thanks for help.

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

Postby TJ » 11 Jan 2010

you are welcome!


Return to “MultiCharts”