{ EB_Trend Eichberger Bands - Trend (C)Copyright, 2014, B.Eichberger from Professional Software Solutions, pss@pobox.com 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 } Input: Lookback(40), Width(100), ExtendType(1), ColorUp(Green), ColorDown(Red); Vars: nBar(0), nSlopePerH(0), nSlopePerL(0), nSlopePerC(0), ColorTrend(Green), nShift(0), idxStart(50), lookbackMax(150), lookbackUse(0), idxBase(0), Counter(0), txtID(Symbol + "_I" + numtostr(BarInterval,0) + "_T" + numtostr(BarType,0) + "_EBTrend"), txtDiag("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxXX"), retEB(0); Array: float arrValIn[50](0), float arrValOut[1000](0); DefineDLLFunc: "C:\Database\PSS_EB\PSS_EB.DLL", int , "PSS_EB", LPSTR,LPFLOAT,LPFLOAT,LPSTR; nBar = BarNumber; lookbackUse = Lookback; IF lookbackUse > lookbackMax THEN lookbackUse = lookbackMax; nShift = lookbackUse/2; arrValIn[0] = Date data1; arrValIn[1] = Time data1; arrValIn[2] = Open data1; arrValIn[3] = High data1; arrValIn[4] = Low data1; arrValIn[5] = Close data1; arrValIn[6] = UpTicks data1; arrValIn[7] = BarNumber data1; arrValIn[8] = BarInterval data1; arrValIn[9] = BarType data1; arrValIn[10]= DownTicks data1; arrValIn[11]= CustomerID; arrValIn[12]= lookbackUse; arrValIn[13]= Width; arrValIn[14]= 1; arrValIn[15]= ExtendType; arrValIn[16]= 0; retEB = PSS_EB(txtID,&arrValIn[0],&arrValOut[0],txtDiag); {====== PROCESS ERRORS ===============================================} IF retEB < -100 THEN RaiseRunTimeError(txtDiag); if retEB >= 0 THEN BEGIN nSlopePerH = arrValOut[2]; nSlopePerL = arrValOut[3]; nSlopePerC = (nSlopePerH + nSlopePerL)/2; ColorTrend = ColorUp; if nSlopePerC < 0 THEN ColorTrend = ColorDown; Plot1[nShift](nSlopePerC, "Trend",ColorTrend); Plot2[nShift](0, "Zero" ) ; //draw extension envelope if retEB > 0 then begin For Counter = 1 To nShift Begin idxBase = idxStart+((Counter-1)*6); nSlopePerC = arrValOut[idxBase+5]; Plot1[nShift-Counter](nSlopePerC, "Trend",ColorTrend); Plot2[nShift-Counter](0, "Zero" ) ; End; end; end;