Hello,
Alexis or anyone else who can help me remove the moving average numbers from the EMA50day volume script. I find them bothersome because they prevent me from seeing the volume for current bar on 5min chart. It would be great if in was fixed in a certain spot or removed completely.
Can this be done?
Thanks,
Brian
/************************************************** *******
Alexis C. Montenegro © July 2003
Use and/or modify this code freely. If you redistribute it
please include this and/or any other comment blocks and a
description of any changes you make.
************************************************** ********/
var vMA = null;
function preMain() {
setPriceStudy(false);
setStudyTitle("Volume-MA");
setCursorLabelName("Volume", 0);
setCursorLabelName("MAofVol", 1);
setCursorLabelName("%ofMA", 2);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.black, 2);
setDefaultBarThickness(5,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(1,2);
setPlotType(PLOTTYPE_HISTOGRAM,0);
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(50); //Edit this value to set a new default
var fp2 = new FunctionParameter("Type", FunctionParameter.STRING);
fp2.setName("Type");
fp2.addOption("MAStudy.SIMPLE");
fp2.addOption("MAStudy.EXPONENTIAL");
fp2.setDefault("MAStudy.EXPONENTIAL"); //Edit this value to set a new default
var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
fp3.addOption("Price");
fp3.addOption("Volume");
fp3.setDefault("Price"); //Edit this value to set a new default
}
function main(Length,Type,Source) {
if (vMA == null) vMA = new MAStudy(Length, 0, "Volume", eval(Type));
/*****************************************
Insert your code following this text block
Use vMA.getValue(MAStudy.MA) for your code
******************************************/
if(Source=="Price"){
if (close() < close(-1))
setBarFgColor(Color.RGB(255,0,0));
else if (close() > close(-1))
setBarFgColor(Color.RGB(0,0,255));
else if (close() == close(-1))
setBarFgColor(Color.RGB(0,0,0));
}
if(Source=="Volume"){
if (volume() < volume(-1))
setBarFgColor(Color.RGB(255,0,0));
else if (volume() > volume(-1))
setBarFgColor(Color.RGB(0,0,255));
else if (volume() == volume(-1))
setBarFgColor(Color.RGB(0,0,0));
}
var PercVol = (volume()/vMA.getValue(MAStudy.MA))*100;
if (PercVol<100)
setBarFgColor(Color.brown,2);
if(PercVol>100)
setBarFgColor(Color.blue,2);
return new Array (volume(),vMA.getValue(MAStudy.MA),PercVol.toFixed (2)+"");
}
Alexis or anyone else who can help me remove the moving average numbers from the EMA50day volume script. I find them bothersome because they prevent me from seeing the volume for current bar on 5min chart. It would be great if in was fixed in a certain spot or removed completely.
Can this be done?
Thanks,
Brian
/************************************************** *******
Alexis C. Montenegro © July 2003
Use and/or modify this code freely. If you redistribute it
please include this and/or any other comment blocks and a
description of any changes you make.
************************************************** ********/
var vMA = null;
function preMain() {
setPriceStudy(false);
setStudyTitle("Volume-MA");
setCursorLabelName("Volume", 0);
setCursorLabelName("MAofVol", 1);
setCursorLabelName("%ofMA", 2);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.black, 2);
setDefaultBarThickness(5,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(1,2);
setPlotType(PLOTTYPE_HISTOGRAM,0);
var fp1 = new FunctionParameter("Length", FunctionParameter.NUMBER);
fp1.setLowerLimit(1);
fp1.setDefault(50); //Edit this value to set a new default
var fp2 = new FunctionParameter("Type", FunctionParameter.STRING);
fp2.setName("Type");
fp2.addOption("MAStudy.SIMPLE");
fp2.addOption("MAStudy.EXPONENTIAL");
fp2.setDefault("MAStudy.EXPONENTIAL"); //Edit this value to set a new default
var fp3 = new FunctionParameter("Source", FunctionParameter.STRING);
fp3.addOption("Price");
fp3.addOption("Volume");
fp3.setDefault("Price"); //Edit this value to set a new default
}
function main(Length,Type,Source) {
if (vMA == null) vMA = new MAStudy(Length, 0, "Volume", eval(Type));
/*****************************************
Insert your code following this text block
Use vMA.getValue(MAStudy.MA) for your code
******************************************/
if(Source=="Price"){
if (close() < close(-1))
setBarFgColor(Color.RGB(255,0,0));
else if (close() > close(-1))
setBarFgColor(Color.RGB(0,0,255));
else if (close() == close(-1))
setBarFgColor(Color.RGB(0,0,0));
}
if(Source=="Volume"){
if (volume() < volume(-1))
setBarFgColor(Color.RGB(255,0,0));
else if (volume() > volume(-1))
setBarFgColor(Color.RGB(0,0,255));
else if (volume() == volume(-1))
setBarFgColor(Color.RGB(0,0,0));
}
var PercVol = (volume()/vMA.getValue(MAStudy.MA))*100;
if (PercVol<100)
setBarFgColor(Color.brown,2);
if(PercVol>100)
setBarFgColor(Color.blue,2);
return new Array (volume(),vMA.getValue(MAStudy.MA),PercVol.toFixed (2)+"");
}
Comment