//Universal Trend Detection System - Indicator
{ UT_Trend
PSS Universal Trend Detection System - Indicator
(C)Copyright, 2009, B.Eichberger from Professional Software Solutions, [email protected]
This program remains the exclusive property of B. EICHBERGER and may not be sold,
used, copied, displayed or modified without the written consent of B. EICHBERGER.
YOU ASSUME FULL LIABILITY FOR ALL TRADING RISKS AND OUTCOMES!
PSS OR ITS EMPLOYEES AND ASSOCIATES ARE NOT RESPONSIBLE FOR ANY LOSS OR PROFIT!
}
Inputs:
UTScope(40),
UTSmooth(1),
UTRecent(2),
UTStep(80),
UTCloseFac(100),
UTColorMax(3),
UTStyle(1),
ColorUp(Green),
ColorNeutral(Yellow),
ColorDown(Red);
Var:
cmt(""),
txtDiag("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"),
txtID(Symbol + "_TREND"),
nColor(0),
ret(0);
Array:
double arrVal[100](0);
{====== UT MODULE INTERFACE =========================================}
DefineDLLFunc: "PSS_UTC.DLL", float , "PSS_UTC", LPSTR, LPDOUBLE, LPSTR;
arrVal[0] = Date data1;
arrVal[1] = Time data1;
arrVal[2] = Open data1;
arrVal[3] = High data1;
arrVal[4] = Low data1;
arrVal[5] = Close data1;
arrVal[6] = Ticks data1;
arrVal[7] = BarNumber data1;
arrVal[8] = BarInterval data1;
arrVal[9] = BarType data1;
arrVal[10] = CustomerID;
arrVal[11] = UTScope;
arrVal[12] = UTSmooth;
arrVal[14] = UTRecent;
arrVal[15] = UTStep;
arrVal[16] = GetBackgroundColor;
arrVal[17] = ColorUp;
arrVal[18] = ColorNeutral;
arrVal[19] = ColorDown;
arrVal[20] = UTCloseFac;
arrVal[21] = UTColorMax;
ret = PSS_UTC(txtID,&arrVal[0],txtDiag);
IF ret > 0 THEN BEGIN
nColor = ColorNeutral;
IF arrVal[61] < 0 THEN
nColor = ColorDown;
IF arrVal[61] > 0 THEN
nColor = ColorUp;
IF UTStyle = 1 THEN BEGIN // Show clipped Trend Grades -5 to +5
IF arrVal[57] = 0 AND arrVal[59] >= 0 THEN
arrVal[57] = 0.5;
IF arrVal[57] = 0 AND arrVal[59] < 0 THEN
arrVal[57] = -0.5;
Plot1(arrVal[57],"Trend",nColor);
Plot2(0,"Zero");
END;
IF UTStyle = 2 THEN BEGIN // Show unclipped Trend Strength
Plot1(arrVal[59],"Trend",nColor);
Plot2(0,"Zero");
Plot3(5,"TrendMax",ColorUp);
Plot4(-5,"TrendMax",ColorDown);
END;
IF UTStyle = 3 THEN BEGIN // Show Trend Age
Plot1(arrVal[60],"Trend",nColor);
Plot2(0,"Zero");
END;
IF UTStyle = 4 THEN BEGIN // Show Direction
Plot1(arrVal[61],"Trend",nColor);
Plot2(0,"Zero");
END;
{====== SHOW BAR COMMENT =============================================}
IF AtCommentaryBar and CommentaryEnabled THEN BEGIN
cmt = "Grade=" + Numtostr(arrVal[57],0) + "(" + Numtostr(arrVal[59],2) + ") Dir=" + Numtostr(arrVal[61],0) + " TrendAge=" + Numtostr(arrVal[60],0) + newline;
cmt = cmt + "Scope=" + Numtostr(UTScope,0) + " Smooth=" + numtostr(UTSmooth,0) + " Recent=" + numtostr(UTRecent,1) + " Step=" + numtostr(UTStep,0) + " CloseFac=" + numtostr(UTCloseFac,0) + " 1.3a" + newline;
commentary(cmt);
END;
END;
IF ret < -100 THEN
RaiseRunTimeError(txtDiag);