http:\/\/www.amibroker.com\/guide\/keyword\/switch.html<\/a><\/p>To display this chart, open the Formula Editor<\/strong>, enter the following code and then press Apply Indicator<\/strong> button.<\/p><\/span>\/\/ detect the active symbol and store in n variable
<\/span>n <\/span>= <\/span>Name<\/span>();
<\/span>\/\/ set parameter values based on the symbol name
<\/span>switch ( <\/span>n <\/span>)
{
<\/span>\/\/ values for MSFT symbol
<\/span>case <\/span>"MSFT"<\/span>:
<\/span>MA1periods <\/span>= <\/span>10<\/span>;
<\/span>MA2periods <\/span>= <\/span>21<\/span>;
break;
<\/span>\/\/ values for IBM and NVDA
<\/span>case <\/span>"IBM"<\/span>:
case <\/span>"NVDA"<\/span>:
<\/span>MA1periods <\/span>= <\/span>30<\/span>;
<\/span>MA2periods <\/span>= <\/span>40<\/span>;
break;
<\/span>\/\/ values for other tickers
<\/span>default:
<\/span>MA1periods <\/span>= <\/span>50<\/span>;
<\/span>MA2periods <\/span>= <\/span>100<\/span>;
break;
}
<\/span>Plot<\/span>( <\/span>Close<\/span>, <\/span>"C"<\/span>, <\/span>colorDefault<\/span>, <\/span>styleBar <\/span>);
<\/span>Plot<\/span>( <\/span>MA<\/span>( <\/span>Close<\/span>, <\/span>MA1periods <\/span>) , <\/span>"MA(" <\/span>+ <\/span>MA1Periods <\/span>+ <\/span>")" <\/span>, <\/span>colorRed <\/span>);
<\/span>Plot<\/span>( <\/span>MA<\/span>( <\/span>Close<\/span>, <\/span>MA2periods <\/span>) , <\/span>"MA(" <\/span>+ <\/span>MA2Periods <\/span>+ <\/span>")"<\/span>, <\/span>colorBlue <\/span>)<\/code>This way we can handle all individual parameter values within a single chart pane.<\/p>","protected":false},"excerpt":{"rendered":"
Parameter values in AmiBroker are stored separately for each ChartID. A ChartID is a number that uniquely identifies chart. This makes it possible that parameters having same name can hold different values when they are used in different charts (different ChartIDs). This also allows to share parameters if two panes use same ChartID. (A detailed […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[53,55,24],"_links":{"self":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/664"}],"collection":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/comments?post=664"}],"version-history":[{"count":2,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/664\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/posts\/664\/revisions\/672"}],"wp:attachment":[{"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/media?parent=664"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/categories?post=664"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.amibroker.com\/wordpress\/kb\/wp-json\/wp\/v2\/tags?post=664"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}