New Chart Indicator: _TRO_PeriodChannels
Posted: Fri Jun 23, 2006 1:18 pm
I wrote a new indicator - _TRO_PeriodChannels .
It is based on my time channels indicator.
It is based on my time channels indicator.
Code: Select all
{ _TRO_PeriodChannels }
{Attn: TradeStation
if this indicator is posted on the TradeStation Forum, I, TheRumpledOne, did NOT post it there,
so I can't be blamed for this indicator having my contact info.}
{Programmer: Avery T. Horton, Jr. aka TheRumpledOne,
gifts and donations accepted, PO Box 43575, Tucson, AZ 85733 }
{ © Copyright 2006 Avery T. Horton, Jr.}
Inputs:
iDecimals(4),
iDate(currentdate),
iStartTime(0000),
iBarsAgo1(5),
iBarsAgo2(10),
iBarsAgo3(20),
iBarsAgo4(50),
iBarsAgo5(200),
iTextTimeMult( 2 ) ,
iHiLoColor(cyan),
iHiLoColor2(blue),
iHiLoColor3(green),
iHiLoColor4(yellow),
iHiLoColor5(red),
TLSize( 0 ), // 0 - 6 for thin to thick
TLStyle( 4 ), // 1 = solid, 2 = dashed, 3 = dotted, 4 = dashed 2, 5 = dashed 3
TL_Text_HVal ( 0 ) , // HVal: 1=left, 0=right, 2=centered,
TL_Text_VVal ( 2 ) ; // VVal: 1=Top, 0=Bottom, 2=Centered
Vars:
xTime(0),
oExtremeVal( 0 ),
oExtremeBar( 0 ) ,
iDebug( false ),
iProcessingDate( currentdate ) ,
sFirstPass(true),
TL_TextTime( 0 ) ,
aTimeCount(0),
aCount(4),
aMax(4),
aLoop(0);
array: tlLO[5](0);
array: tlLotxt[5](0);
array: tlHi[5](0);
array: tlHitxt[5](0);
array: aTime[5](0);
array: aBarsAgo[5](0);
array: aHigh[5](0);
array: aLow[5](0);
array: aColor[5](0);
{first time through}
if sFirstPass
then begin
sFirstPass = false;
aBarsAgo[000] = iBarsAgo1 ;
aBarsAgo[001] = iBarsAgo2 ;
aBarsAgo[002] = iBarsAgo3 ;
aBarsAgo[003] = iBarsAgo4 ;
aBarsAgo[004] = iBarsAgo5 ;
aColor[000] = iHiLoColor ;
aColor[001] = iHiLoColor2 ;
aColor[002] = iHiLoColor3 ;
aColor[003] = iHiLoColor4 ;
aColor[004] = iHiLoColor5 ;
end; {if sFirstPass}
{ calculations }
xTime = time this bar ;
aTime[000] = xTime[iBarsAgo1] ;
aTime[001] = xTime[iBarsAgo2] ;
aTime[002] = xTime[iBarsAgo3] ;
aTime[003] = xTime[iBarsAgo4] ;
aTime[004] = xTime[iBarsAgo5] ;
oExtremeVal = Extremes( L , iBarsAgo1 , -1, aLow[0] , oExtremeBar ) ; // lowest low
oExtremeVal = Extremes( H , iBarsAgo1 , 1, aHigh[0] , oExtremeBar ) ; // highest high
oExtremeVal = Extremes( L , iBarsAgo2 , -1, aLow[1] , oExtremeBar ) ; // lowest low
oExtremeVal = Extremes( H , iBarsAgo2 , 1, aHigh[1] , oExtremeBar ) ; // highest high
oExtremeVal = Extremes( L , iBarsAgo3 , -1, aLow[2] , oExtremeBar ) ; // lowest low
oExtremeVal = Extremes( H , iBarsAgo3 , 1, aHigh[2] , oExtremeBar ) ; // highest high
oExtremeVal = Extremes( L , iBarsAgo4 , -1, aLow[3] , oExtremeBar ) ; // lowest low
oExtremeVal = Extremes( H , iBarsAgo4 , 1, aHigh[3] , oExtremeBar ) ; // highest high
oExtremeVal = Extremes( L , iBarsAgo5 , -1, aLow[4] , oExtremeBar ) ; // lowest low
oExtremeVal = Extremes( H , iBarsAgo5 , 1, aHigh[4] , oExtremeBar ) ; // highest high
{++++++ Text Location +++++++++}
TL_TextTime = AddTime( Time , iTextTimeMult * BarInterval ) ;
if condition99 = false then begin
for aLoop = 0 to aMax
begin
tlHi[aLoop] = TL_New(iDate[0], aTime[aLoop], 99999, iDate, Time, 99999);
tlHitxt[aLoop] = Text_New(idate, aTime[aLoop], aHigh[aLoop] , numtostr(aBarsAgo[aLoop] , 0) + " Bar High " + numtostr(aLoop , 0) );
tlLO[aLoop] = TL_New(iDate[0], aTime[aLoop], 99999, iDate, Time, 99999);
tlLotxt[aLoop] = Text_New(idate, aTime[aLoop],aLow[aLoop] , numtostr(aBarsAgo[aLoop] , 0) +" Low " + numtostr(aLoop , 0) );
Text_SetLocation(tlHitxt[aLoop],idate, Time , aHigh[aLoop]);
Text_SetStyle(tlHitxt[aLoop], TL_Text_HVal , TL_Text_VVal);
Text_SetColor(tlHitxt[aLoop],aColor[aLoop]);
Text_SetLocation(tlLotxt[aLoop],idate, Time , aLow[aLoop]);
Text_SetStyle(tlLotxt[aLoop], TL_Text_HVal , TL_Text_VVal);
Text_SetColor(tlLotxt[aLoop],aColor[aLoop]);
end; // for aLoop = 0 to aMax
End; // if condition99 = false then begin
Condition99=True;
{+++++++++++ Trend Lines ++++++++++++}
for aLoop = 0 to aMax
begin
TL_SetBegin(tlHi[aLoop], iDate, aTime[aLoop], aHigh[aLoop]);
TL_SetEnd(tlHi[aLoop], iDate, time , aHigh[aLoop]);
TL_SetColor(tlHi[aLoop],aColor[aLoop]);
TL_SetExtLeft(tlHi[aLoop],false);
TL_SetExtRight(tlHi[aLoop],false);
TL_SetStyle(tlHi[aLoop],TLStyle);
Text_SetString(tlHitxt[aLoop], numtostr(aBarsAgo[aLoop] , 0) + " Bar High "+numtostr(aHigh[aLoop], iDecimals ));
Text_SetLocation(tlHitxt[aLoop],idate, TL_TextTime, aHigh[aLoop]);
Text_SetStyle(tlHitxt[aLoop], TL_Text_HVal , TL_Text_VVal);
Text_SetColor(tlHitxt[aLoop],aColor[aLoop]);
TL_SetBegin(tlLO[aLoop], iDate, aTime[aLoop], aLow[aLoop]);
TL_SetEnd(tlLO[aLoop], iDate, time, aLow[aLoop]);
TL_SetColor(tlLO[aLoop],aColor[aLoop]);
TL_SetExtLeft(tlLo[aLoop],false);
TL_SetExtRight(tlLO[aLoop],false);
TL_SetStyle(tlLO[aLoop],TLStyle);
Text_SetString(tlLotxt[aLoop], numtostr(aBarsAgo[aLoop] , 0) + " Bar Low "+numtostr(aLow[aLoop], iDecimals ));
Text_SetLocation(tlLotxt[aLoop],idate, TL_TextTime , aLow[aLoop]);
Text_SetStyle(tlLotxt[aLoop], TL_Text_HVal , TL_Text_VVal);
Text_SetColor(tlLotxt[aLoop],aColor[aLoop]);
end; // for aLoop = 0 to aMax