Hi Folks,
I've a question dealing with data types that i'm sure i'm just missing the obvious on but..... declaring a value and occasionaly giving it a new value and then adding a numeric value to it results in a string for some reason ie.
var gOldvVMA = null;
var vVMA = null;
var vMA = null;
var gPM = 10000;
function main() {
if (vMA == null) vMA = new MAStudy(5, 0, "Close", MAStudy.SIMPLE);
vVMA = call( "AnVolume.efs" ); // returns MA based on Volume
if(gOldvVMA == null) gOldvVMA = vVMA;
if(Strategy.isLong() && vVMA > gOldvVMA) gOldvVMA = vVMA;
if(Strategy.isShort() && vVMA < gOldvVMA) gOldvVMA = vVMA;
if(vMA.getValue(MAStudy.MA)>vMA.getValue(MAStudy.M A,-1)){
if(vVMA > gOldvVMA+10/gPM){
debugPrintln("Values : " + vMA.getValue(MAStudy.MA) + " " + vMA.getValue(MAStudy.MA,-1) + " " + vVMA + " " + gOldvVMA + " " + gOldvVMA+(10/gPM));
}
}
}
the above switch does not get met but returns
Form Output Window
Values : 1.308719 1.3087 1.3074 1.3074 1.3074.001 <- last number is the one in question.
Last number is a string of the two numbers added together whereas I actually need the value of the two numbers added together (ie 1.3084). Any ideas or solutions would be greatly appreciated.
Thanks..
Chris
I've a question dealing with data types that i'm sure i'm just missing the obvious on but..... declaring a value and occasionaly giving it a new value and then adding a numeric value to it results in a string for some reason ie.
var gOldvVMA = null;
var vVMA = null;
var vMA = null;
var gPM = 10000;
function main() {
if (vMA == null) vMA = new MAStudy(5, 0, "Close", MAStudy.SIMPLE);
vVMA = call( "AnVolume.efs" ); // returns MA based on Volume
if(gOldvVMA == null) gOldvVMA = vVMA;
if(Strategy.isLong() && vVMA > gOldvVMA) gOldvVMA = vVMA;
if(Strategy.isShort() && vVMA < gOldvVMA) gOldvVMA = vVMA;
if(vMA.getValue(MAStudy.MA)>vMA.getValue(MAStudy.M A,-1)){
if(vVMA > gOldvVMA+10/gPM){
debugPrintln("Values : " + vMA.getValue(MAStudy.MA) + " " + vMA.getValue(MAStudy.MA,-1) + " " + vVMA + " " + gOldvVMA + " " + gOldvVMA+(10/gPM));
}
}
}
the above switch does not get met but returns
Form Output Window
Values : 1.308719 1.3087 1.3074 1.3074 1.3074.001 <- last number is the one in question.
Last number is a string of the two numbers added together whereas I actually need the value of the two numbers added together (ie 1.3084). Any ideas or solutions would be greatly appreciated.
Thanks..
Chris
Comment