GetJTIStudy() Advanced GET Study Functions
Creates object, which allows to get signals of indicator Advanced GET JTI in EFS scripts. The Joseph Trend Index (JTI) is based upon a trend tracking and strength algorithm developed by Tom Joseph. This indicator can be used in conjunction with the Expert Trend Locator (XTL) as a confirmation of a trend due to the fact that they are independent calculations and are not related.
Syntax
GetJTIStudy( nBand1 , nBand2 , nFast , TrendLength )
Parameters
Parameter: | Description: | Default: |
nBand1 | Upper band
|
n/a |
nBand2 | Lower band
|
n/a |
bFast | Boolean. Should be equal True when you want the JTI to be extremely sensitive to any change in the trend strength. This setting should be used with caution due to the fact that it can give many false signals.
|
n/a |
TrendLength | Allows to choose what length of trend the JTI should display. To choose use the follwing constants: GetJTIStudy.SHORT, GetJTIStudy.MEDIUM, GetJTIStudy.NORMAL, GetJTIStudy.LONG.
|
n/a |
Member(s)
Syntax: | Returned value: |
GetJTIStudy.JTI | Returns the value of JTI
|
GetJTIStudy.COLORS | Returns the stength of trend, presented in the folowing values: 0 - NOISE, 1 - LOW, 2 - MEDIUM, 3 - STRONG, 4 - UNDEFINED
|
Notes
Only available in versions 7.9 or later.
Code Example
Creation Object Example:
var vJTI = null; function main() { if (vJTI == null) vJTI = new GetJTIStudy(100, -100, false, GetJTIStudy.NORMAL); var iJTI = vJTI.getValue(GetJTIStudy.JTI); var cJTI = vJTI.getValue(GetJTIStudy.COLORS); return new Array(iJTI, cJTI); }
JTI Indicator:
var fpArray = new Array(); function preMain(){ askForInput(); setDefaultBarThickness(2, 0) setStudyTitle("AGET JTI"); setCursorLabelName("JTI", 0); setCursorLabelName(" ", 1); setShowTitleParameters(false); setPlotType(PLOTTYPE_INSTANTCOLORLINE); var x = 0; fpArray[x] = new FunctionParameter("nBand1", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Band1"); setDefault(30); } fpArray[x] = new FunctionParameter("nBand2", FunctionParameter.NUMBER); with(fpArray[x++]){ setName("Band2"); setDefault(-30); } fpArray[x] = new FunctionParameter("gColorBand", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Band Color"); setDefault(Color.grey); } fpArray[x] = new FunctionParameter("bFast", FunctionParameter.BOOLEAN); with(fpArray[x++]){ setName("Fast Mode"); setDefault(false); } var x = 0; fpArray[x] = new FunctionParameter("TrendLength", FunctionParameter.STRING); with(fpArray[x++]){ setName("TrendLength"); addOption("Short"); addOption("Medium"); addOption("Normal"); addOption("Long"); setDefault("Normal"); } fpArray[x] = new FunctionParameter("gColorStrong", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Strong Trend Color"); setDefault(Color.red); } fpArray[x] = new FunctionParameter("gColorMedium", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Medium Trend Color"); setDefault(Color.blue); } fpArray[x] = new FunctionParameter("gColorLow", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Low Trend Color"); setDefault(Color.lime); } fpArray[x] = new FunctionParameter("gColorNoise", FunctionParameter.COLOR); with(fpArray[x++]){ setName("Noise Trend Color"); setDefault(Color.yellow); } } var vJTI = null; var bInit = false; function main(nBand1, nBand2, gColorBand, bFast, TrendLength, gColorStrong, gColorMedium, gColorLow, gColorNoise){ if (!bInit){ switch (TrendLength) { case "Short": TrendLength = GetJTIStudy.SHORT; break; case "Medium": TrendLength = GetJTIStudy.MEDIUM; break; case "Normal": TrendLength = GetJTIStudy.NORMAL; break; case "Long": TrendLength = GetJTIStudy.LONG; break; } if (vJTI == null) vJTI = new GetJTIStudy(nBand1, nBand2, bFast, TrendLength); addBand(nBand1, PS_DASH, 1, gColorBand, "nBand1"); addBand(nBand2, PS_DASH, 1, gColorBand, "nBand2"); bInit = true; } var sStrengthTrend = "N/A"; var cJTIColor = getChartBG(); switch (vJTI.getValue(GetJTIStudy.COLORS)){ case 0: sStrengthTrend = "NOISE"; cJTIColor = gColorNoise; break; case 1: sStrengthTrend = "LOW"; cJTIColor = gColorLow; break; case 2: sStrengthTrend = "MEDIUM"; cJTIColor = gColorMedium; break; case 3: sStrengthTrend = "STRONG"; cJTIColor = gColorStrong; break; } setBarFgColor(cJTIColor, 0); setBarFgColor(cJTIColor, 1); return new Array(vJTI.getValue(GetJTIStudy.JTI), sStrengthTrend); }
See Also