I've spent the last hour looking at the threads for Max2 ma's with alerts. I still have not been able to find one posted with an adjustable interval.
Iwant to use the below attached script but with an alert.
Ideally the alert would sound when the price touches and/or crosses just one ma but if that's not available, one that alerts on a two ma crossover would be fine also.
Below is the max2 scrpt that I am currently using (that doesnt have an alert)
Thanks for directing me to the file if there is one available
/************************************************** *******
Alexis C. Montenegro © December 2004
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 fpArray = new Array();
function preMain() {
setPriceStudy(true);
setStudyTitle("MAx2");
setCursorLabelName("MA1",0);
setCursorLabelName("MA2",1);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarFgColor(Color.red,1);
setPlotType(PLOTTYPE_LINE,0);
setPlotType(PLOTTYPE_LINE,1);
setDefaultBarThickness(1,0);
setDefaultBarThickness(1,1);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Type1", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("sma");
addOption("ema");
addOption("wma");
addOption("vwma");
setDefault("sma");
}
fpArray[x] = new FunctionParameter("Length1", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(3);
}
fpArray[x] = new FunctionParameter("Source1", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Offset1", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(0);
}
fpArray[x] = new FunctionParameter("Type2", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("sma");
addOption("ema");
addOption("wma");
addOption("vwma");
setDefault("sma");
}
fpArray[x] = new FunctionParameter("Length2", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(10);
}
fpArray[x] = new FunctionParameter("Source2", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Offset2", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(0);
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("DI+ Color");
setDefault(Color.blue);
}
fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("DI- Color");
setDefault(Color.red);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xMA1 = null;
var xMA2 = null;
function main(Type1,Length1,Source1,Offset1,Type2,Length2,S ource2,Offset2,Symbol,Interval,LineColor1,LineColo r2,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
vSymbol = Symbol+","+Interval;
xMA1 = offsetSeries(eval(Type1)(Length1,eval(Source1)(sym (vSymbol))),Offset1);
xMA2 = offsetSeries(eval(Type2)(Length2,eval(Source2)(sym (vSymbol))),Offset2);
setDefaultBarFgColor(LineColor1,0);
setDefaultBarFgColor(LineColor2,1);
setShowTitleParameters(eval(Params));
bInit = true;
}
return new Array (getSeries(xMA1),getSeries(xMA2));one
Iwant to use the below attached script but with an alert.
Ideally the alert would sound when the price touches and/or crosses just one ma but if that's not available, one that alerts on a two ma crossover would be fine also.
Below is the max2 scrpt that I am currently using (that doesnt have an alert)
Thanks for directing me to the file if there is one available
/************************************************** *******
Alexis C. Montenegro © December 2004
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 fpArray = new Array();
function preMain() {
setPriceStudy(true);
setStudyTitle("MAx2");
setCursorLabelName("MA1",0);
setCursorLabelName("MA2",1);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarFgColor(Color.red,1);
setPlotType(PLOTTYPE_LINE,0);
setPlotType(PLOTTYPE_LINE,1);
setDefaultBarThickness(1,0);
setDefaultBarThickness(1,1);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Type1", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("sma");
addOption("ema");
addOption("wma");
addOption("vwma");
setDefault("sma");
}
fpArray[x] = new FunctionParameter("Length1", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(3);
}
fpArray[x] = new FunctionParameter("Source1", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Offset1", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(0);
}
fpArray[x] = new FunctionParameter("Type2", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("sma");
addOption("ema");
addOption("wma");
addOption("vwma");
setDefault("sma");
}
fpArray[x] = new FunctionParameter("Length2", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(10);
}
fpArray[x] = new FunctionParameter("Source2", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("open");
addOption("high");
addOption("low");
addOption("close");
addOption("hl2");
addOption("hlc3");
addOption("ohlc4");
setDefault("close");
}
fpArray[x] = new FunctionParameter("Offset2", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault(0);
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault();
}
fpArray[x] = new FunctionParameter("LineColor1", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("DI+ Color");
setDefault(Color.blue);
}
fpArray[x] = new FunctionParameter("LineColor2", FunctionParameter.COLOR);
with(fpArray[x++]){
setName("DI- Color");
setDefault(Color.red);
}
fpArray[x] = new FunctionParameter("Params", FunctionParameter.BOOLEAN);
with(fpArray[x++]){
setName("Show Parameters");
setDefault(false);
}
}
var bInit = false;
var xMA1 = null;
var xMA2 = null;
function main(Type1,Length1,Source1,Offset1,Type2,Length2,S ource2,Offset2,Symbol,Interval,LineColor1,LineColo r2,Params) {
if(bInit == false){
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
vSymbol = Symbol+","+Interval;
xMA1 = offsetSeries(eval(Type1)(Length1,eval(Source1)(sym (vSymbol))),Offset1);
xMA2 = offsetSeries(eval(Type2)(Length2,eval(Source2)(sym (vSymbol))),Offset2);
setDefaultBarFgColor(LineColor1,0);
setDefaultBarFgColor(LineColor2,1);
setShowTitleParameters(eval(Params));
bInit = true;
}
return new Array (getSeries(xMA1),getSeries(xMA2));one