Good morning guys!
I am trying to place a button on a chart that will allow me to quickly change the chart background color but am having no luck. Thank you in advance.
Charley
I am trying to place a button on a chart that will allow me to quickly change the chart background color but am having no luck. Thank you in advance.
Charley
PHP Code:
var fpArray = new Array();
function preMain() {
setPriceStudy(true);
setStudyTitle("Chart BG");
setShowCursorLabel(false);
setShowTitleParameters(false);
setDefaultChartBG(Color.black);
var x=0;
fpArray[x] = new FunctionParameter("aColor", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Button Color");
setDefault(Color.grey);
}
fpArray[x] = new FunctionParameter("bColor", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Chart Color");
setDefault(Color.black);
}
fpArray[x] = new FunctionParameter("cColor", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("Chart Color");
setDefault(Color.white);
}
}
function main(aColor, bColor, cColor) {
drawTextPixel(0, 12, "@URL=EFS:ChartBG", null, aColor, Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM, null, null, "Button", 40, 16);
function ChartBG(nButtonPressed) {
if (getButtonPressed(nButtonPressed) == 1) {
setChartBG(cColor);
}
else if (getButtonPressed(nButtonPressed) == 2) {
setChartBG(bColor);
}
}
}
function getButtonPressed(nButtonPressed) {
if (nButtonPressed == BUTTON_LEFT) {
return(1);
}
else if
(nButtonPressed == BUTTON_RIGHT) {
return(2);
}
}
Comment