I was attempting to add Xover arrows to the code below and got lost along the way. Can someone familiar with EFS2 offer some assistance/guidance. The syntax error(s) are at line 80, 85
Thanks
Doug
var lastrawtime = 0;
var BarCount = 0;
var fpArray = new Array();
var amLib = addLibrary("amStudies.efsLib");
function preMain() {
setStudyTitle("MTF NormMACD1");
setCursorLabelName("MACD",0);
setCursorLabelName("MACDSig",1);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarFgColor(Color.red,1);
setPlotType(PLOTTYPE_LINE,0);
setPlotType(PLOTTYPE_LINE,1);
setDefaultBarThickness(1,0);
setDefaultBarThickness(1,1);
setDefaultBarThickness(1,2);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Fast", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(12);
}
fpArray[x] = new FunctionParameter("Slow", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(26);
}
fpArray[x] = new FunctionParameter("Smoothing", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(5);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("Open");
addOption("High");
addOption("Low");
addOption("Close");
setDefault("Close");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault("");
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault("");
}
}
var bInit = false;
var vSymbol = null;
function main(Fast,Slow,Smoothing,Source,Symbol,Interval){
if(bInit == false){
addBand(0,PS_SOLID,1,Color.aqua,"Centerline");
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
vSymbol = Symbol+","+Interval;
bInit = true;
}
var xMACD = amLib.amDEMA(2,efsInternal("ratio",Fast,Slow,Smoot hing,Source,sym(vSymbol)));
var xSig = wma(Smoothing,xMACD);
var space = 1;
if (lastrawtime != getValue("rawtime", 0)) {
BarCount += 1;
lastrawtime = getValue("rawtime", 0);
}
if(xMACD.getValue(amLib.amDEMA(2,efsInternal("rati o",Fast,Slow,Smoothing,Source,sym(vSymbol)))) > xSig.getValue(wma(Smoothing,xMACD) && xMACD.getValue(amLib.amDEMA(2,efsInternal("ratio", Fast,Slow,Smoothing,Source,sym(vSymbol))),-1) < xSig.getValue(wma(Smoothing,xMACD),-1){
drawTextRelative(0,low()-(space*1.0),"é",Color.lime,null,Text.TOP|Text.CENT ER|Text.BOLD,"Wingdings",10,"Up"+ BarCount);
}else{
removeText("Up"+BarCount);
}
if(xMACD.getValue(amLib.amDEMA(2,efsInternal("rati o",Fast,Slow,Smoothing,Source,sym(vSymbol)))) < xSig.getValue(wma(Smoothing,xMACD) && xMACD.getValue(amLib.amDEMA(2,efsInternal("ratio", Fast,Slow,Smoothing,Source,sym(vSymbol))),-1) > xSig.getValue(wma(Smoothing,xMACD),-1){
drawTextRelative(0,high()+(space*1.0),"ê",Color.re d,null,Text.BOTTOM|Text.CENTER|Text.BOLD,"Wingding s",10,"Dn"+ BarCount);
}else{
removeText("Dn"+BarCount);
}
return new Array (xMACD,xSig);
}
function ratio(){
var x = 0;
var sht = wma(12);
var lng = wma(26);
var ratio = (Math.min(sht,lng)/Math.max(sht,lng));
var ret = sht>lng?((2-ratio)-1)*100(ratio)-1)*100;
return ret;
}
Thanks
Doug
var lastrawtime = 0;
var BarCount = 0;
var fpArray = new Array();
var amLib = addLibrary("amStudies.efsLib");
function preMain() {
setStudyTitle("MTF NormMACD1");
setCursorLabelName("MACD",0);
setCursorLabelName("MACDSig",1);
setDefaultBarFgColor(Color.blue,0);
setDefaultBarFgColor(Color.red,1);
setPlotType(PLOTTYPE_LINE,0);
setPlotType(PLOTTYPE_LINE,1);
setDefaultBarThickness(1,0);
setDefaultBarThickness(1,1);
setDefaultBarThickness(1,2);
askForInput();
var x=0;
fpArray[x] = new FunctionParameter("Fast", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(12);
}
fpArray[x] = new FunctionParameter("Slow", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(26);
}
fpArray[x] = new FunctionParameter("Smoothing", FunctionParameter.NUMBER);
with(fpArray[x++]){
setLowerLimit(1);
setDefault(5);
}
fpArray[x] = new FunctionParameter("Source", FunctionParameter.STRING);
with(fpArray[x++]){
addOption("Open");
addOption("High");
addOption("Low");
addOption("Close");
setDefault("Close");
}
fpArray[x] = new FunctionParameter("Symbol", FunctionParameter.STRING);
with(fpArray[x++]){
setDefault("");
}
fpArray[x] = new FunctionParameter("Interval", FunctionParameter.NUMBER);
with(fpArray[x++]){
setDefault("");
}
}
var bInit = false;
var vSymbol = null;
function main(Fast,Slow,Smoothing,Source,Symbol,Interval){
if(bInit == false){
addBand(0,PS_SOLID,1,Color.aqua,"Centerline");
if(Symbol == null) Symbol = getSymbol();
if(Interval == null) Interval = getInterval();
vSymbol = Symbol+","+Interval;
bInit = true;
}
var xMACD = amLib.amDEMA(2,efsInternal("ratio",Fast,Slow,Smoot hing,Source,sym(vSymbol)));
var xSig = wma(Smoothing,xMACD);
var space = 1;
if (lastrawtime != getValue("rawtime", 0)) {
BarCount += 1;
lastrawtime = getValue("rawtime", 0);
}
if(xMACD.getValue(amLib.amDEMA(2,efsInternal("rati o",Fast,Slow,Smoothing,Source,sym(vSymbol)))) > xSig.getValue(wma(Smoothing,xMACD) && xMACD.getValue(amLib.amDEMA(2,efsInternal("ratio", Fast,Slow,Smoothing,Source,sym(vSymbol))),-1) < xSig.getValue(wma(Smoothing,xMACD),-1){
drawTextRelative(0,low()-(space*1.0),"é",Color.lime,null,Text.TOP|Text.CENT ER|Text.BOLD,"Wingdings",10,"Up"+ BarCount);
}else{
removeText("Up"+BarCount);
}
if(xMACD.getValue(amLib.amDEMA(2,efsInternal("rati o",Fast,Slow,Smoothing,Source,sym(vSymbol)))) < xSig.getValue(wma(Smoothing,xMACD) && xMACD.getValue(amLib.amDEMA(2,efsInternal("ratio", Fast,Slow,Smoothing,Source,sym(vSymbol))),-1) > xSig.getValue(wma(Smoothing,xMACD),-1){
drawTextRelative(0,high()+(space*1.0),"ê",Color.re d,null,Text.BOTTOM|Text.CENTER|Text.BOLD,"Wingding s",10,"Dn"+ BarCount);
}else{
removeText("Dn"+BarCount);
}
return new Array (xMACD,xSig);
}
function ratio(){
var x = 0;
var sht = wma(12);
var lng = wma(26);
var ratio = (Math.min(sht,lng)/Math.max(sht,lng));
var ret = sht>lng?((2-ratio)-1)*100(ratio)-1)*100;
return ret;
}
Comment