bug? or Whats the difference between vars and constants?

Questions about MultiCharts and user contributed studies.
Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

bug? or Whats the difference between vars and constants?

Postby Dug » 02 Sep 2009

Not sure how to word this, but there is definately something going on...
This is the simple code i was testing.....
to get two different donchian channels.
Problem is when adding the second plot, and compiling it does not replot correctly.

{Donchian Channel}
Inputs: Base(Close),Length(25);

Variables:DonLow(0),DonlowExtra(0);

DonLow = Lowest( low, Length);
DonLowExtra=lowest(low,20);

Plot2(DonLow, "DonchianLo");
plot4(DonLowExtra,"xlow");

But when i plot to chart there is only one plot? Yes they are both visible, and they give the same values.....

So i guess the question is... When you change anything in an indicator and compile it. The only sure way to get it to work /plot correctly is to delete it, and then reload it. Just changing the status or compiling will not plot it correctly.???

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

Postby TJ » 02 Sep 2009

how different are these values?

DonLow = Lowest( low, Length);
DonLowExtra=lowest(low,20);



you have to get a chart and manually pick out the values to see.

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 02 Sep 2009

Hi TJ,
the values are sometimes the same, sometimes different.
I noticed that something strange was going on initially when I plotted two different plots when both had the same values, and plotted two slightly different charts.
Then i experimented a little.
With two different values, say 20 and 25, you would expect two slightly different plots, sometimes deviating from each other, sometimes at the same value
But what i found was that they generally did not.... IF YOU COMPILE and then update in the chart. What I found was that that you actually have to remove the indicator from the chart, then reinstall it on the chart.
This is not what i expected and more than anything i guess this is a heads up to young players (like myself) not to go looking for needles in a haystack when the numbers look a bit askew when trying the program.

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

Postby TJ » 02 Sep 2009

once you applied an indicator to a chart
the value in the input variable is in your chart.

If you change the input value of the indicator in the PowerEditor,
that change will NOT affect the input value you have already applied in the charts.

This protocol is made to safeguard the numerous custom values you have already applied to your many other charts.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Postby janus » 03 Sep 2009

This protocol is made to safeguard the numerous custom values you have already applied to your many other charts.
This is true. However, if you exit and re-enter MC, the new settings in the study are used in place of any custom ones. So, it's another catch. There's no easy and correct approach for MC. Just need to be aware of these issues. I think i would prefer the loaded studies to be updated dynamically when the source code is recompiled to avoid confusion. But no matter, I'm used to it now.

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

Postby TJ » 03 Sep 2009

This protocol is made to safeguard the numerous custom values you have already applied to your many other charts.
This is true. However, if you exit and re-enter MC, the new settings in the study are used in place of any custom ones.
only if you save the Study Format setting as "Default".

So, it's another catch. There's no easy and correct approach for MC. Just need to be aware of these issues. I think i would prefer the loaded studies to be updated dynamically when the source code is recompiled to avoid confusion. But no matter, I'm used to it now.
if you need the new setting to apply to all existing charts,
you have to change the variable name.

e.g.

old setting:

var:
color(red);


use ctrl-H to change all variable names to new name and new setting:

var:
color1(blue);
Last edited by TJ on 03 Sep 2009, edited 1 time in total.

janus
Posts: 835
Joined: 25 May 2009
Has thanked: 63 times
Been thanked: 104 times

Postby janus » 03 Sep 2009

Thanks for the tips. I'm assuming you are referring to the "User as Default" check box when inserting a study. If you are, it doesn't appear to make any difference to me. In fact, what I said before was not completely correct. Each time I recompile a study with a different value for the default input variable, the new value is never picked up until I unload and reload the study. Simply re-starting MC only keeps using the previous value. Now I see why I get confusing results sometimes. I better get into the practice of unloading and re-loading my studies each time I start MC just in case.

Dug
Posts: 31
Joined: 26 Aug 2009
Location: London

Postby Dug » 04 Sep 2009

Ditto...it confused me as there are sometimes too many options.
I now get into the habit of any signal/ indicator that I am working on when i make changes I unload and reload. It only takes a second or two, but it ensures that it will pick up all the changes I may have made, without having to think...did I or didnt I.
By saving certain parameters as the default at least i maintain the same colours etc;


Return to “MultiCharts”