Greetings,
Thought perhaps someone could use this; appologies if someone has already posted this:
This is a 6 period TRIX study.
Cheers,
Joshua C. Bergeron
Thought perhaps someone could use this; appologies if someone has already posted this:
This is a 6 period TRIX study.
PHP Code:
var StudyEMA1 = new MAStudy(6, 0, "close", MAStudy.EXPONENTIAL);
var StudyEMA2 = new MAStudy(6, 0, StudyEMA1, MAStudy.MA, MAStudy.EXPONENTIAL);
var StudyEMA3 = new MAStudy(6, 0, StudyEMA2, MAStudy.MA, MAStudy.EXPONENTIAL);
var prev_ema3 = null;
var trix = null;
function preMain()
{
setPriceStudy(true);
setDefaultBarThickness(1, 0);
setCursorLabelName("Trix 6", 0);
setDefaultBarFgColor(Color.red, 0);
}
function main()
{
if (getBarState() == BARSTATE_NEWBAR)
{
ema1 = StudyEMA1.getValue(MAStudy.MA);
ema2 = StudyEMA2.getValue(MAStudy.MA);
ema3 = StudyEMA3.getValue(MAStudy.MA);
if (prev_ema3 != null)
trix = ema3 - prev_ema3 / prev_ema3;
prev_ema3 = ema3;
}
if (trix != null)
return trix;
}
Joshua C. Bergeron