The following code is a modified Bollinger Band efs study that uses external intervals. It seems to (not tested enough, though) work fine if it’s applied on a chart with one or two additional efs loaded but with my current setup the code stops updating. It also messes up all other charts with the same interval and instrument. That is, for example all GBP/USD 5 min contract charts cease updating, both the study and price data. Shifting back and forth through different timeframes and back again to the original sometimes corrects the situation but only temporarily.
Is it an efs or the eSignal application issue? I currently use ver. 10.3
---------
function preMain() {
setPriceStudy(true);
setStudyTitle("BB3 XX");
setCursorLabelName("UpperBB", 0 );
setCursorLabelName("MiddleBB", 1 );
setCursorLabelName("LowerBB", 2 );
setDefaultBarFgColor(Color.teal, 0); // upper
setDefaultBarFgColor(Color.red, 1); // middle
setDefaultBarFgColor(Color.teal, 2); // lower
setDefaultBarStyle(PS_DOT, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_DOT, 2);
var fp1 = new FunctionParameter("Interval", FunctionParameter.STRING);
fp1.setDefault("XX");
fp1.addOption("XX");
fp1.addOption(30);
fp1.addOption(60);
fp1.addOption(120);
var fp2 = new FunctionParameter("STDEV", FunctionParameter.NUMBER);
fp2.setDefault(3);
fp2.addOption(2);
fp2.addOption(3);
}
//var study = new BollingerStudy(20, "Close", 2.0);
var myStudy1 = null;
var myStudy2 = null;
var myStudy3 = null;
var bInit = false;
var bButtonPressed = false;
var bDisplayStudy = null;
//var Interval = getInterval();
function main(Interval,STDEV) {
var xFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM| Text.BOLD;
// draw the actual button on the screen and attach it to our custom handler
drawTextPixel(195, 15, "BB"+STDEV+" "+Interval+"m@URL=EFS:toggleBand", Color.blue, Color.yellow, xFlags , "Courier New", 11, -55);
if (bDisplayStudy != true) return;
var myVar1;
var myVar2;
var myVar3;
if ( bInit == false ) {
if(Interval != "XX") {
myStudy1 = upperBB(20, STDEV, close(inv(Interval)));
myStudy2 = middleBB(20, STDEV, close(inv(Interval)));
myStudy3 = lowerBB(20, STDEV, close(inv(Interval)));
}
else {
myStudy1 = upperBB(20, STDEV);
myStudy2 = middleBB(20, STDEV);
myStudy3 = lowerBB(20, STDEV);
}
bInit = true;
}
myVar1 = myStudy1.getValue(0);
myVar2 = myStudy2.getValue(0);
myVar3 = myStudy3.getValue(0);
return new Array(myVar1, myVar2, myVar3);
}
// Abifunktsioonid hiirega opereerimiseks.
//== function determines if a button was pressed
function getButtonPressed(nButtonPressed) {
if(nButtonPressed == BUTTON_LEFT) {
return(1);
}
else {
return(0);
}
}
//== performs a specific task if our button was pressed
function toggleBand( nButtonPressed ) {
if ( getButtonPressed( nButtonPressed ) == 1 ) {
bButtonPressed = true;
bDisplayStudy = !bDisplayStudy; // muudab väärtuse vastupidiseks -on/off
reloadEFS();
//programeerimise abistamiseks info kuvamine-pole EFS toimiseks vajalik
if(bButtonPressed == true) debugPrintln("Button Pressed");
if(bDisplayStudy == true) debugPrintln("Display Study = true");
}
return;
}
Is it an efs or the eSignal application issue? I currently use ver. 10.3
---------
function preMain() {
setPriceStudy(true);
setStudyTitle("BB3 XX");
setCursorLabelName("UpperBB", 0 );
setCursorLabelName("MiddleBB", 1 );
setCursorLabelName("LowerBB", 2 );
setDefaultBarFgColor(Color.teal, 0); // upper
setDefaultBarFgColor(Color.red, 1); // middle
setDefaultBarFgColor(Color.teal, 2); // lower
setDefaultBarStyle(PS_DOT, 0);
setDefaultBarStyle(PS_SOLID, 1);
setDefaultBarStyle(PS_DOT, 2);
var fp1 = new FunctionParameter("Interval", FunctionParameter.STRING);
fp1.setDefault("XX");
fp1.addOption("XX");
fp1.addOption(30);
fp1.addOption(60);
fp1.addOption(120);
var fp2 = new FunctionParameter("STDEV", FunctionParameter.NUMBER);
fp2.setDefault(3);
fp2.addOption(2);
fp2.addOption(3);
}
//var study = new BollingerStudy(20, "Close", 2.0);
var myStudy1 = null;
var myStudy2 = null;
var myStudy3 = null;
var bInit = false;
var bButtonPressed = false;
var bDisplayStudy = null;
//var Interval = getInterval();
function main(Interval,STDEV) {
var xFlags = Text.ONTOP | Text.RELATIVETOLEFT | Text.RELATIVETOBOTTOM| Text.BOLD;
// draw the actual button on the screen and attach it to our custom handler
drawTextPixel(195, 15, "BB"+STDEV+" "+Interval+"m@URL=EFS:toggleBand", Color.blue, Color.yellow, xFlags , "Courier New", 11, -55);
if (bDisplayStudy != true) return;
var myVar1;
var myVar2;
var myVar3;
if ( bInit == false ) {
if(Interval != "XX") {
myStudy1 = upperBB(20, STDEV, close(inv(Interval)));
myStudy2 = middleBB(20, STDEV, close(inv(Interval)));
myStudy3 = lowerBB(20, STDEV, close(inv(Interval)));
}
else {
myStudy1 = upperBB(20, STDEV);
myStudy2 = middleBB(20, STDEV);
myStudy3 = lowerBB(20, STDEV);
}
bInit = true;
}
myVar1 = myStudy1.getValue(0);
myVar2 = myStudy2.getValue(0);
myVar3 = myStudy3.getValue(0);
return new Array(myVar1, myVar2, myVar3);
}
// Abifunktsioonid hiirega opereerimiseks.
//== function determines if a button was pressed
function getButtonPressed(nButtonPressed) {
if(nButtonPressed == BUTTON_LEFT) {
return(1);
}
else {
return(0);
}
}
//== performs a specific task if our button was pressed
function toggleBand( nButtonPressed ) {
if ( getButtonPressed( nButtonPressed ) == 1 ) {
bButtonPressed = true;
bDisplayStudy = !bDisplayStudy; // muudab väärtuse vastupidiseks -on/off
reloadEFS();
//programeerimise abistamiseks info kuvamine-pole EFS toimiseks vajalik
if(bButtonPressed == true) debugPrintln("Button Pressed");
if(bDisplayStudy == true) debugPrintln("Display Study = true");
}
return;
}
Comment