Sort of adding on to this here. The below was an immense help to DDE use with the forex symbols. Would it be possible to get an efficient format for DDE returning more than one variable in a single EFS document while still using the below naming system?
For Example, Returning Entry Date, Entry price, Stop Price, and ATR value from a strategy?
Many thanks,
Tim
Posting an Example here - Need to Avoid getting Excelt to return [object series] from the ddelink - attaching the pertinent areas of the code
Is there a simple answer to returning the dde values with something other than [object series]?
Best Regards,
Tim
For Example, Returning Entry Date, Entry price, Stop Price, and ATR value from a strategy?
Many thanks,
Tim
Posting an Example here - Need to Avoid getting Excelt to return [object series] from the ddelink - attaching the pertinent areas of the code
PHP Code:
function preMain(){
setPriceStudy(true);
}
//lines 6-29 Omitted (declaring global vars
var ddeATR = null;
var ddeEND = null;
var ddeENP = null;
var ddeSTP = null;
var ddeDIR = null;
function main() {
if (ddeATR == null) {
var sName = "ATR" + getSymbol() +"_"+ getInterval();
sName = sName.replace("$", ""); // remove $ from string
sName = sName.replace("#", ""); // remove # from string
sName = sName.replace("-", ""); // remove # from string
sName = sName.replace(" ", "_") // replace space with underscore
debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
ddeATR = new DDEOutput(sName);
}
if (ddeEND == null) {
var sName = "END" + getSymbol() +"_"+ getInterval();
sName = sName.replace("$", ""); // remove $ from string
sName = sName.replace("#", ""); // remove # from string
sName = sName.replace("-", ""); // remove # from string
sName = sName.replace(" ", "_") // replace space with underscore
debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
ddeEND = new DDEOutput(sName);
}
if (ddeENP == null) {
var sName = "ENP" + getSymbol() +"_"+ getInterval();
sName = sName.replace("$", ""); // remove $ from string
sName = sName.replace("#", ""); // remove # from string
sName = sName.replace("-", ""); // remove # from string
sName = sName.replace(" ", "_") // replace space with underscore
debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
ddeENP = new DDEOutput(sName);
}
if (ddeSTP == null) {
var sName = "STP" + getSymbol() +"_"+ getInterval();
sName = sName.replace("$", ""); // remove $ from string
sName = sName.replace("#", ""); // remove # from string
sName = sName.replace("-", ""); // remove # from string
sName = sName.replace(" ", "_") // replace space with underscore
debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
ddeSTP = new DDEOutput(sName);
}
if (ddeDIR == null) {
var sName = "DIR" + getSymbol() +"_"+ getInterval();
sName = sName.replace("$", ""); // remove $ from string
sName = sName.replace("#", ""); // remove # from string
sName = sName.replace("-", ""); // remove # from string
sName = sName.replace(" ", "_") // replace space with underscore
debugPrintln("DDE Link for Excel =eSignal|EFS!"+sName);
ddeDIR = new DDEOutput(sName);
}
//lines 85 - 248 Omitted (these work and should not have effect on the dde portion that I need to get working
if((value2 == 1) && (value1 != 0)) value2 = 0;
if ((value2 == 1 ) && (value1 == 0) && (v2p == 0) && (Strategy.isLong() == false)) {
setBarBgColor(Color.RGB(0,255,0))
//Long Position entry
lgstp = ll3p;
Strategy.doLong("Enter 03 Long",Strategy.CLOSE,Strategy.THISBAR,1)
enthhl = hhp;
entlll = LL;
trigl = (high() + (avgrg * 7));
eatrl = avgrg;
lentp = close();
lgms = ll3p;
eday = 1;
entdl = day(0);
}
if((value2 == -1) && (value1 != 0)) value2 = 0;
if ((value2 == -1) && (value1 == 0) && (v2p == 0)) {
// Short Position Entry
setBarBgColor(Color.RGB(255,0,0))
ststp = hh3p;
Strategy.doShort("Enter 03 Short",Strategy.CLOSE,Strategy.THISBAR,1);
enthhs = HH;
entlls = LL;
trigs = dlow + (avgrg * 7);
eatrs = avgrg;
sentp = tdcl;
stms = hh3p;
eday = 1;
entds = day(0);
}
if (Strategy.isLong() == true) {
datr = eatrl;
dend = entdl;
denp = lentp;
dstp = lgstp;
ddir = 1;
ddeEND.set(dend);
ddeENP.set(denp);
ddeSTP.set(dstp);
ddeDIR.set(ddir);
ddeATR.set(datr);
}
if(Strategy.isShort() == true) {
datr = eatrs;
dend = entds;
denp = sentp;
dstp = ststp;
ddir = -1;
ddeEND.set(dend);
ddeENP.set(denp);
ddeSTP.set(dstp);
ddeDIR.set(ddir);
ddeATR.set(datr);
}
//lines 303 - 473 Omitted (exit portion of strategy)
return new Array(datr,dend,denp,dstp,ddir);
Best Regards,
Tim
Comment