Hello,
I would like an efs to use that will indicate when the Aroon Up crosses over the Aroon Down..I have something "similar" ie a MA crossover,, and would like to modify it to use for Aroons instead.. can you help me with that?
WIll paste the MA one below:
(I see the line numbers didn't get copied, if you need to see that just let me know how to get that copied)
Study(5, 0, "Close" , MAStudy.EXPONENTIAL);
var vMA2 = new MAStudy(20, 0, "Close" , MAStudy.SIMPLE);
var fp6 = new FunctionParameter("Background", FunctionParameter.STRING);
fp6.addOption("On");
fp6.addOption("Off");
fp6.setDefault("On"); //Edit this value to set a new default
function preMain() {
setPriceStudy(true);
setStudyTitle("MAx5over20(one alert, use on 60min)");
setCursorLabelName("MA1", 0);
setCursorLabelName("MA2", 1);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.red, 1);
setDefaultChartBG(Color.black);
}
var vFlag1 = 0;
var vFlag2 = 0;
function main() {
//this section determines the relative position of the averages at the prior bar
//and sets the Flags accordingly
if(getBarState() == BARSTATE_NEWBAR){
if(vMA1.getValue(MAStudy.MA,-1) > vMA2.getValue(MAStudy.MA,-1)){
vFlag1 = 1;
vFlag2 = 1;
}
if(vMA1.getValue(MAStudy.MA,-1) < vMA2.getValue(MAStudy.MA,-1)){
vFlag1 = -1;
vFlag2 = -1;
}
}
//the following section triggers alerts only in the direction determined by the code above
//if crossing over
if(vFlag1 == -1){
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
Alert.playSound("cowbell.wav");
vFlag2 = 1;
}
if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
vFlag2 = -1;
}
}
//if crossing under
if(vFlag1 == 1){
if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
Alert.playSound("drip.wav");
vFlag2 = -1;
}
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
vFlag2 = 1;
}
}
if(Background=="On"){
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
setChartBG(Color.khaki);
}
else if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
setChartBG(Color.darkgrey);
}
else{
setChartBG(Color.black);
}
}
return new Array (vMA1.getValue(MAStudy.MA),vMA2.getValue(MAStudy.M A));
}
I would like an efs to use that will indicate when the Aroon Up crosses over the Aroon Down..I have something "similar" ie a MA crossover,, and would like to modify it to use for Aroons instead.. can you help me with that?
WIll paste the MA one below:
(I see the line numbers didn't get copied, if you need to see that just let me know how to get that copied)
Study(5, 0, "Close" , MAStudy.EXPONENTIAL);
var vMA2 = new MAStudy(20, 0, "Close" , MAStudy.SIMPLE);
var fp6 = new FunctionParameter("Background", FunctionParameter.STRING);
fp6.addOption("On");
fp6.addOption("Off");
fp6.setDefault("On"); //Edit this value to set a new default
function preMain() {
setPriceStudy(true);
setStudyTitle("MAx5over20(one alert, use on 60min)");
setCursorLabelName("MA1", 0);
setCursorLabelName("MA2", 1);
setDefaultBarFgColor(Color.blue, 0);
setDefaultBarFgColor(Color.red, 1);
setDefaultChartBG(Color.black);
}
var vFlag1 = 0;
var vFlag2 = 0;
function main() {
//this section determines the relative position of the averages at the prior bar
//and sets the Flags accordingly
if(getBarState() == BARSTATE_NEWBAR){
if(vMA1.getValue(MAStudy.MA,-1) > vMA2.getValue(MAStudy.MA,-1)){
vFlag1 = 1;
vFlag2 = 1;
}
if(vMA1.getValue(MAStudy.MA,-1) < vMA2.getValue(MAStudy.MA,-1)){
vFlag1 = -1;
vFlag2 = -1;
}
}
//the following section triggers alerts only in the direction determined by the code above
//if crossing over
if(vFlag1 == -1){
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
Alert.playSound("cowbell.wav");
vFlag2 = 1;
}
if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
vFlag2 = -1;
}
}
//if crossing under
if(vFlag1 == 1){
if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
Alert.playSound("drip.wav");
vFlag2 = -1;
}
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
vFlag2 = 1;
}
}
if(Background=="On"){
if(vMA1.getValue(MAStudy.MA) > vMA2.getValue(MAStudy.MA) && vFlag2 == -1){
setChartBG(Color.khaki);
}
else if(vMA1.getValue(MAStudy.MA) < vMA2.getValue(MAStudy.MA) && vFlag2 == 1){
setChartBG(Color.darkgrey);
}
else{
setChartBG(Color.black);
}
}
return new Array (vMA1.getValue(MAStudy.MA),vMA2.getValue(MAStudy.M A));
}
Comment