Any reason or tweak needed for a custom efs that works fine in 10.6 but crashes the 11.3 application when loaded?
Announcement
Collapse
No announcement yet.
EFS working in 10.6 but not 11.3
Collapse
This topic is closed.
X
X
-
reiddar
It could be due to any reason and without seeing the script it is not possible to determine what this could be short of guessing
Alex
Originally posted by reiddar
I'm unable to post it for various reasons, just wondering if anyone else has had this issue and/or if there's a simple solution to why it could be happening.
Thank you
Comment
-
Sample Script from V10.6
Alexis,
Here is some sample script that works in V10.6 but, try as I might, I can't seem to get it to run in V11.3.
I have tried different indicator combinations individually, and 2 at a time, and that works, but not this whole stream of 3.
Any clues may be valuable lessons learned for others...
Cheers,
Dan
/*************************
.3 Deep
***************************/
function preMain() {
}
var bInit = false;
var nSMA, LRofSMAs, MACDofLRofSMAs ;
function main() {
if(!bInit){
nSMA = sma(5, "close");
nSMA = getSeries(nSMA);
LRofSMAs = getSeries(efsInternal("LRofSMAcalc", nSMA));
MACDofLRofSMAs = macd(1,5,1, LRofSMAs);
MACDofLRofSMAs = getSeries(MACDofLRofSMAs);
bInit = true;
}
return MACDofLRofSMAs;
}
function LRofSMAcalc(nSMA){
var i = 4;
var sum = 0;
var k = 0;
var LRofSMA = 0;
for(k = i; k > 0; k--)
sum += (k - (i + 1) / 3) * nSMA.getValue(k - i)
LRofSMA = 6 / (i * (i + 1)) * sum;
return LRofSMA
}
Comment
-
Re: Sample Script from V10.6
Dan
From what I am seeing the issue is that the macd() function is failing in 11.x when directly calling a series created by an efsInternal() or efsExternal() function.
FWIW I have seen a similar issue a few times also in 10.x [one instance for example was related to the Bollinger Bands functions] and eSignal eventually fixed it.
A simple workaround I used at the time and that is also applicable in this case is to wrap the efsInternal() or efsExternal() call in another series function that does not have this issue and that can act as a proxy [for lack of a better term] without altering the original values returned by the efsInternal() or efsExternal() calls.
The simplest solution in this case is to use the sma() function (a one period simple moving average does not change the value of the study it is based on) as I show in the enclosed revision of your script [which includes some other changes commented in the script].
Once eSignal resolves the issue then you simply remove the wrapper sma() function
Alex
PHP Code:function preMain() {
}
var bInit = false;
var LRofSMAs, MACDofLRofSMAs ;//removed nSMA
function main() {
if(!bInit){
//nSMA = sma(5);//this line was incorrectly written as sma(5,"close") should have been sma(5, close()) but
//since close() is already the default it is not required
//Also unless the nSMA variable is required on its own it is not necessary to initialize it
//separately and can be passed directly in the efsInternal() call
LRofSMAs = sma(1,efsInternal("LRofSMAcalc", sma(5)));//wrapped efsInternal() call in sma() and passed sma(5)
//directly in the efsInternal() call
MACDofLRofSMAs = getSeries(macd(1,5,1, LRofSMAs));//wrapped macd() call in getSeries() no need to
//do that separately.
bInit = true;
}
return MACDofLRofSMAs;
}
function LRofSMAcalc(nSMA){
var i = 4;
var sum = 0;
var k = 0;
var LRofSMA = 0;
for(k = i; k > 0; k--)
sum += (k - (i + 1) / 3) * nSMA.getValue(k - i)
LRofSMA = 6 / (i * (i + 1)) * sum;
return LRofSMA
}
Originally posted by Desert Dan
Alexis,
Here is some sample script that works in V10.6 but, try as I might, I can't seem to get it to run in V11.3.
I have tried different indicator combinations individually, and 2 at a time, and that works, but not this whole stream of 3.
Any clues may be valuable lessons learned for others...
Cheers,
Dan
/*************************
.3 Deep
***************************/
function preMain() {
}
var bInit = false;
var nSMA, LRofSMAs, MACDofLRofSMAs ;
function main() {
if(!bInit){
nSMA = sma(5, "close");
nSMA = getSeries(nSMA);
LRofSMAs = getSeries(efsInternal("LRofSMAcalc", nSMA));
MACDofLRofSMAs = macd(1,5,1, LRofSMAs);
MACDofLRofSMAs = getSeries(MACDofLRofSMAs);
bInit = true;
}
return MACDofLRofSMAs;
}
function LRofSMAcalc(nSMA){
var i = 4;
var sum = 0;
var k = 0;
var LRofSMA = 0;
for(k = i; k > 0; k--)
sum += (k - (i + 1) / 3) * nSMA.getValue(k - i)
LRofSMA = 6 / (i * (i + 1)) * sum;
return LRofSMA
}
Comment
-
Alexis,
Thank you for the logic and eventual workaround. It works well in this case, and is a very neat solution which probably can be tried and applied to other such cases - hopefully including reiddars, here.
By the way, please accept my apology for directing the mail at you, it should have been to the group.
Reiddar,
My apologies also. I did not mean to hijack your thread as such, just trying to add to the list of V11 issues, and solutions, as you had asked for.
Cheers,
Dan
Comment
-
@Dan,
Not to worry, asked the question because I needed the same solution as you....
Seems we have a mutual friend.
You can find me on skype under the same username, I'm sure we'd have lots to discuss.
@Alexis,
Thank you kindly for solving the issue.Last edited by reiddar; 11-12-2011, 09:33 PM.
Comment
Comment