Take a quick look at this EFS script:
function preMain() {
}
// Global Variables
var dLastVol = 0;
var dTickID = 0;
var study1 = new MAStudy(10, 0, "Close", MAStudy.Simple);
var study2 = new MAStudy(50, 0, "Close", MAStudy.Simple);
function preMain() {
setPriceStudy(true);
}
function main() {
var vMA1 = study1.getValue(MAStudy.MA);
var vMA2 = study2.getValue(MAStudy.MA);
// Data Values
var dClose = close(0);
var dLow = low(0);
var dHigh = high(0);
var dOpen = open(0);
var dVolume = volume(0);
if (volume(0) < dLastVol)
{
//New Candle
dLastVol =0
}
var dCurVol = (volume(0) - dLastVol);
dLastVol = volume(0);
dTickID ++;
//Time Values
var tYear = getYear(0);
var tMonth = getMonth(0);
var tDay = getDay(0);
var tHour = getHour(0);
var tMinute = getMinute(0);
var tSecond = getSecond(0);
//Print Data Values
debugPrint("MA Val: " + vMA1 + "\n");
debugPrint("Open : " + dOpen + "\n");
debugPrint("High : " + dHigh + "\n");
debugPrint("Low : " + dLow + "\n");
debugPrint("Close : " + dClose + "\n");
debugPrint("Vol : " + dVolume + "\n");
debugPrint("Tick Vol: " + dCurVol + "\n");
debugPrint("Tick ID: " + dTickID + "\n");
//Print Time Values
debugPrint("\n");
debugPrint("Date: " + tMonth +"/"+ tDay + "/" + tYear + "\n");
debugPrint("Time: " + tHour +":"+ tMinute + "." + tSecond + "\n");
return (vMA1);
}
It doesnt really do much, just prints out the values of the current market data. But the minute I apply it to the chart or reload the saved version it locks my CPU for 25-30 seconds any ideas on why this occurs???
Thanks
function preMain() {
}
// Global Variables
var dLastVol = 0;
var dTickID = 0;
var study1 = new MAStudy(10, 0, "Close", MAStudy.Simple);
var study2 = new MAStudy(50, 0, "Close", MAStudy.Simple);
function preMain() {
setPriceStudy(true);
}
function main() {
var vMA1 = study1.getValue(MAStudy.MA);
var vMA2 = study2.getValue(MAStudy.MA);
// Data Values
var dClose = close(0);
var dLow = low(0);
var dHigh = high(0);
var dOpen = open(0);
var dVolume = volume(0);
if (volume(0) < dLastVol)
{
//New Candle
dLastVol =0
}
var dCurVol = (volume(0) - dLastVol);
dLastVol = volume(0);
dTickID ++;
//Time Values
var tYear = getYear(0);
var tMonth = getMonth(0);
var tDay = getDay(0);
var tHour = getHour(0);
var tMinute = getMinute(0);
var tSecond = getSecond(0);
//Print Data Values
debugPrint("MA Val: " + vMA1 + "\n");
debugPrint("Open : " + dOpen + "\n");
debugPrint("High : " + dHigh + "\n");
debugPrint("Low : " + dLow + "\n");
debugPrint("Close : " + dClose + "\n");
debugPrint("Vol : " + dVolume + "\n");
debugPrint("Tick Vol: " + dCurVol + "\n");
debugPrint("Tick ID: " + dTickID + "\n");
//Print Time Values
debugPrint("\n");
debugPrint("Date: " + tMonth +"/"+ tDay + "/" + tYear + "\n");
debugPrint("Time: " + tHour +":"+ tMinute + "." + tSecond + "\n");
return (vMA1);
}
It doesnt really do much, just prints out the values of the current market data. But the minute I apply it to the chart or reload the saved version it locks my CPU for 25-30 seconds any ideas on why this occurs???
Thanks
Comment