How to remove a chart pane's margins
Updated on 2011-09-24 04:22:04
Let us say you want to create a chart pane that is colored in green when the stock is trending up and in red when it is trending down. You want the whole area to be colored and you don't want white spaces, "create indicators" icons and date/price information. These three items can be hidden by calling a special instruction that removes a chart pane's margins.
- Create a new pane
- Right click on it then select "Edit Formula"
- Type the following formula:
a = LinearReg_Angle(30);
Plot(a > 0, "Trend", colorGreen|255|colorGreen, ChartStep, StyleOwnScale);
Plot(a < 0, "Trend", colorRed|255|colorRed, ChartStep, StyleOwnScale);
UpdateSettings("Full Pane", 1);
Margins are removed by calling the "UpdateSettings" function. To display the list of available options (within this function), use CONTROL+SPACE shortcut after you type: "UpdateSettings(".
The second parameter gets a rule that determines whether to apply the setting or not. "1" means that the new setting should be applied on all bars. If you had specified "open > close" then the full pane mode will be activated only when the open price is higher than the close price.
In the above formula, stock trend direction is defined by measuring the angle of the 30-Bar linear regression of the close series.