Link not found . . .
Hey Andy,
Thanks for your immediate response, I truly appreciate it. The link you gave me is dead, so maybe you can try that again sometime. But as a better explanation, and being fresh in the morning, this is what I need to do. This is such a good piece of functionality, that I think a good discussion will help others.
So I have my personal EFS, that I have loaded with all these other pieces of code and some standard stuff that makes or breaks my strategy. When I use standard E-Sig studies, I just load them in the chart, and call them in the EFS as such:
DECLARATION:
var study1 = new RSIStudy(14, "Close");
OBTAIN VALUE:
var myRSI = study1.getValue(RSIStudy.RSI);
This I am fine with. Now comes some choice piece of code from TSS that I feel is going to help my efforts, for instance:
function preMain()
{
setStudyTitle("Ergotic_MDI (Mean Deviation Indicator)");
setCursorLabelName("ErgMDI", 0);
setCursorLabelName("SigLin", 1);
setCursorLabelName("ZeroLine", 2);
setDefaultBarFgColor(Color.fushcia, 0);
setDefaultBarFgColor(Color.grey, 1);
setDefaultBarFgColor(Color.cyan, 2);
}
var XA1_1 = 0.0;
var XA2_1 = 0.0;
var XA3_1 = 0.0;
var XA4_1 = 0.0;
function main(r, s, u, ZeroLine)
{
if (r == null) r = 32;
if (s == null) s = 5;
if (u == null) u = 5;
if (ZeroLine == null) ZeroLine = 0;
var FactorR = 2 / (r + 1);
var FactorS = 2 / (s + 1);
var FactorU = 2 / (u + 1);
var Close = close(0);
var XA1 = FactorR * Close + (1 - FactorR) * XA1_1;
var XA2 = FactorS * (Close - XA1) + (1 - FactorS) * XA2_1;
var XA3 = FactorU * XA2 + (1 - FactorU) * XA3_1;
var XA4 = FactorU * XA3 + (1 - FactorU) * XA4_1;
if (getBarState() == BARSTATE_NEWBAR)
{
XA1_1 = XA1;
XA2_1 = XA2;
XA3_1 = XA3;
XA4_1 = XA4;
}
return new Array(XA3, XA4, ZeroLine);
}
So this is what I understand. I need to use the call() function, I need to place this EFS in my E-Sig Doc Root Directory, but what I do not understand is how to translate the actual calls.
I know that:
return new Array(XA3, XA4, ZeroLine);
returns values in the EFS through the main() by:
function main(r, s, u, ZeroLine)
My only major missing piece, is how to substitute the commands:
DECLARATION:
var study1 = new RSIStudy(14, "Close");
OBTAIN VALUE:
var myRSI = study1.getValue(RSIStudy.RSI);
with equivalent commands, when I am using a custom study? So how do I call the values returned by r, s, and u from main in my own study.
I appreciate any help on this, it is so key in my understanding of what I am doing right now, so I want to make sure I get it right.
Thanks,
Thomas.
Hey Andy,
Thanks for your immediate response, I truly appreciate it. The link you gave me is dead, so maybe you can try that again sometime. But as a better explanation, and being fresh in the morning, this is what I need to do. This is such a good piece of functionality, that I think a good discussion will help others.
So I have my personal EFS, that I have loaded with all these other pieces of code and some standard stuff that makes or breaks my strategy. When I use standard E-Sig studies, I just load them in the chart, and call them in the EFS as such:
DECLARATION:
var study1 = new RSIStudy(14, "Close");
OBTAIN VALUE:
var myRSI = study1.getValue(RSIStudy.RSI);
This I am fine with. Now comes some choice piece of code from TSS that I feel is going to help my efforts, for instance:
function preMain()
{
setStudyTitle("Ergotic_MDI (Mean Deviation Indicator)");
setCursorLabelName("ErgMDI", 0);
setCursorLabelName("SigLin", 1);
setCursorLabelName("ZeroLine", 2);
setDefaultBarFgColor(Color.fushcia, 0);
setDefaultBarFgColor(Color.grey, 1);
setDefaultBarFgColor(Color.cyan, 2);
}
var XA1_1 = 0.0;
var XA2_1 = 0.0;
var XA3_1 = 0.0;
var XA4_1 = 0.0;
function main(r, s, u, ZeroLine)
{
if (r == null) r = 32;
if (s == null) s = 5;
if (u == null) u = 5;
if (ZeroLine == null) ZeroLine = 0;
var FactorR = 2 / (r + 1);
var FactorS = 2 / (s + 1);
var FactorU = 2 / (u + 1);
var Close = close(0);
var XA1 = FactorR * Close + (1 - FactorR) * XA1_1;
var XA2 = FactorS * (Close - XA1) + (1 - FactorS) * XA2_1;
var XA3 = FactorU * XA2 + (1 - FactorU) * XA3_1;
var XA4 = FactorU * XA3 + (1 - FactorU) * XA4_1;
if (getBarState() == BARSTATE_NEWBAR)
{
XA1_1 = XA1;
XA2_1 = XA2;
XA3_1 = XA3;
XA4_1 = XA4;
}
return new Array(XA3, XA4, ZeroLine);
}
So this is what I understand. I need to use the call() function, I need to place this EFS in my E-Sig Doc Root Directory, but what I do not understand is how to translate the actual calls.
I know that:
return new Array(XA3, XA4, ZeroLine);
returns values in the EFS through the main() by:
function main(r, s, u, ZeroLine)
My only major missing piece, is how to substitute the commands:
DECLARATION:
var study1 = new RSIStudy(14, "Close");
OBTAIN VALUE:
var myRSI = study1.getValue(RSIStudy.RSI);
with equivalent commands, when I am using a custom study? So how do I call the values returned by r, s, and u from main in my own study.
I appreciate any help on this, it is so key in my understanding of what I am doing right now, so I want to make sure I get it right.
Thanks,
Thomas.
Comment