{ _TRO_Dynamic_RangeSR - plot dynamic range } {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 2007 Avery T. Horton, Jr.} inputs: iDecimals(4), iMaxThreshold(.0020), iMaxThresholdColor(cyan), iMinThreshold(.0009), iMinThresholdColor(magenta), iStartDate(1070101), // if not intraday, date to start counting iPrice( Close ), iPeriods(5); variables: fg1(white), bg1(black), xAppType(0), sFirstPass(true), tInd(""), tAlert(""), tFib(""), xRange(0), xPosition(0), oExtremeVal( 0 ), oExtremeBar( 0 ) ; variables: xBars( 0 ), xPeriods(05), xOldPeriods(0), Dynamic_R( 0 ), Dynamic_S( 0 ), OldDynamic_R( 0 ), OldDynamic_S( 0 ), PrevDynamic_R( 0 ), PrevDynamic_S( 0 ) ; {commentary variables} variables: xcomm(0), oComm1( "" ), oComm2( "" ), oComm3( "" ), oComm4( "" ), oComm5( "" ), oComm6( "" ), oComm7( "" ), oComm8( "" ), oComm9( "" ), oComm10( "" ); {first time through} if sFirstPass then begin sFirstPass = false; { APP TYPE TEST } sFirstPass = false; xAppType = GetAppInfo(aiApplicationType); // cUnknown = 0 cChart = 1 cRadarScreen = 2 cOptionStation = 3 end; {if sFirstPass} { INITIALIZE } tInd = ""; tAlert = ""; { CALCULATIONS } If date this bar >= iStartDate then begin {save old values} If Dynamic_R <> PrevDynamic_R then OldDynamic_R = PrevDynamic_R; If Dynamic_S <> PrevDynamic_S then OldDynamic_S = PrevDynamic_S ; OldDynamic_R = PrevDynamic_R ; OldDynamic_S = PrevDynamic_S ; PrevDynamic_R = Dynamic_R ; PrevDynamic_S = Dynamic_S ; oExtremeVal = Extremes( L, iPeriods, -1, Dynamic_S , oExtremeBar ) ; // lowest low oExtremeVal = Extremes( H, iPeriods, 1, Dynamic_R , oExtremeBar ) ; // highest high If Dynamic_R <> H and Dynamic_R < PrevDynamic_R then if PrevDynamic_R <> 0 then Dynamic_R = PrevDynamic_R; If Dynamic_S <> L and Dynamic_S > PrevDynamic_S then if PrevDynamic_S <> 0 then Dynamic_S = PrevDynamic_S; xRange = Dynamic_R - Dynamic_S ; { Alert criteria } If xRange >= xRange[1] then begin Fg1 = green; end else If xRange < xRange[1] then begin Fg1 = red; end; If xRange >= iMaxThreshold then begin Fg1 = iMaxThresholdColor; tAlert = "Dyn Threshold Maximum" ; end else If xRange <= iMinThreshold then begin Fg1 = iMinThresholdColor; tAlert = "Dyn Threshold Minimum" ; end; { Alert } if tAlert <> "" then Alert( tAlert ) ; { PLOT } Plot1(xRange , "Dyn Range", fg1 ) ; end; // If date >= xStartDate if xAppType = 2 then begin Plot2(tAlert , "Alert", fg1 ) ; end; CommentaryCl( "Dynamic_R: ", NumToStr( Dynamic_R , iDecimals) ); CommentaryCl( "Dynamic_S: ", NumToStr( Dynamic_S , iDecimals) ); CommentaryCl( "Dynamic Range: ", NumToStr( xRange , iDecimals) );