TradeStation HRFP August 27, 2014 10:46PM |
Registered: 9 years ago Posts: 271 |
{********************************************************************* *** FP/HRFP Indicator by NCT *** *** Strict crossing Now Approach *** *** 2014-08-25 *** *** Designed specifically for RadarScreen *** ********************************************************************} {*** User Inputs ***} Inputs: { CC } CCR_Length( 0 {Rec CC} ), //MA Fast Length CCG_Length( 0 {Green CC}), //MA Slow Length CC_Offset( 0 {Displacement: Positive #} ) , //MA Displacement { StochRSI } RSILength( 0 {RSI Length}), StoLength( 0 {Stoch Length}), PctKSmooth( 0 {%K Smoothing Red}), PctDSmooth( 0 {%D Smoothing Green}), { MACD } FastLength( 0 {MACD Short} ), SlowLength( 0 {MACD Long} ), MACDLength( 0 {MACD Avg Length}), { DMI } DMIPlusLen( 0 {+DMI Red} ), DMIMinusLen( 0 {-DMI Green}); {*** Declare Variables ***} variables: { MAs } MAFastR( 0 ), MASlow( 0 ), MASlowG( 0 ), MASlowDisp( 0 ) , MADiff( 0 ) , { StochRSI } MyRSI( 0 ) , PctK( 0 ) , MyPctK( 0 ) , MyPctD( 0 ) , SRSIDiff( 0 ), { MACD } MyMACD( 0 ), MACDAvg( 0 ), MACDDiff( 0 ), { DMI } MyDMIPlus( 0 ), MyDMIMinus( 0 ), DMIDiff( 0 ), { Indicator Flags } MA_UP( 0 ), MA_Down( 0 ), SRSI_UP( 0 ), SRSI_Down( 0 ), MACD_UP( 0 ), MACD_Down( 0 ), DMI_Up( 0 ), DMI_Down( 0 ), Sum_Up( 0 ), Sum_Down( 0 ), Signal("", { Application Identifier } RS( GetAppInfo(aiApplicationType) = 2 ); // True if indicator inserted in a Radarscreen {********************************************************************* *** Calculations *** *** Future update - create functions to recycle code *** ********************************************************************} { MAs } MAFastR = AverageFC( Close, CCR_Length ); MASlow = AverageFC( Close, CCG_Length ); MASlowG = MASlow[CC_Offset]; //Displacing slow MA (CCG) manually for now MADiff = MAFastR - MASlowG; { StochRSI } { Not the same as standard TS StochRSI. Calc tested well and seemed to be a better match with QC & TOS } MyRSI = RSI( Close, RSILength ); PctK = 100 * ( MyRSI - Lowest( MyRSI, StoLength))/(Highest( MyRSI,StoLength) - Lowest( MyRSI, StoLength) ); MyPctK = Average( PctK,PctKSmooth ); MyPctD = Average( MyPctK,PctDSmooth ); SRSIDiff = MyPctK - MyPctD ; { MACD } MyMACD = MACD( Close, FastLength, SlowLength ) ; MACDAvg = XAverage( MyMACD, MACDLength ) ; MACDDiff = MyMACD - MACDAvg ; { DMI } MyDMIPlus = DMIPlus( DMIPlusLen ) ; MyDMIMinus = DMIMinus( DMIMinusLen ) ; DMIDiff = MyDMIPlus - MyDMIMinus ; {***************************************************************************** *** Check for Cross & assign count *** ****************************************************************************} { CC } If MAFastR crosses over MASlowG Then Begin MA_Up = 1; MA_Down = 0; End Else If MAFastR crosses under MASlowG Then Begin MA_Up = 0; MA_Down = 1; End Else Begin MA_Up = 0; MA_Down = 0; End; { SRSI } If MyPctK crosses over MyPctD Then Begin SRSI_Up = 1; SRSI_Down = 0; End Else If MyPctK crosses under MyPctD Then Begin SRSI_Up = 0; SRSI_Down = 1; End Else Begin SRSI_Up = 0; SRSI_Down = 0; End; { MACD } If MyMACD crosses over MACDAvg Then Begin MACD_Up = 1; MACD_Down = 0; End Else If MyMACD crosses under MACDAvg Then Begin MACD_Up = 0; MACD_Down = 1; End Else Begin MACD_Up = 0; MACD_Down = 0; End; { DMI } If MyDMIPlus crosses over MyDMIMinus Then Begin DMI_Up = 1; DMI_Down = 0; End Else If MyDMIPlus crosses under MyDMIMinus Then Begin DMI_Up = 0; DMI_Down = 1; End Else Begin DMI_Up = 0; DMI_Down = 0; End; { Sum Crossings } Sum_Up = MA_UP + SRSI_UP + MACD_UP + DMI_UP; Sum_Down = MA_Down + SRSI_Down + MACD_Down + DMI_Down; {******************************************************************************************************** *** RADARSCREEN *** *******************************************************************************************************} If RS Then Begin { Check to see if signal on last closed candle } If Sum_Up >= 3 Then Begin Plot1(Signal,"FP/HRFP",Black); // cross = 3 set plot color green or red SetPlotBGColor(1, Green); End Else If Sum_Down >= 3 Then Begin Plot1(Signal,"FP/HRFP",Black); SetPlotBGColor(1,Red); End Else If Sum_Up = 2 Then Begin Plot1(Signal,"FP/HRFP", rgb(155,155,155)) ; // cross up = 2 set plot color to pale green or pink SetPlotBGColor(1, rgb(176,255,176)); End Else if Sum_Down = 2 Then Begin Plot1(signal,"FP/HRFP", rgb(155,155,155)) ; SetPlotBGColor(1, rgb(255,176,176)); End {************************************************************************************************* *** The section below checks for crossing 2 bars ago for those wanting to know about *** *** a recent cross but waiting for a pullback. Currently commented out. To use this *** *** section you need to remove the comment brackets "{" and "}" on lines 227 and 250. *** *** RadarScreen will then show any signal that occured over the last two bars *** ************************************************************************************************} { { Check to see if signal on last candle +1 } Else If Sum_Up[1] >= 3 Then Begin Plot1(Signal,"FP/HRFP",Black); // cross = 3 set plot color green or red SetPlotBGColor(1, Green); End Else If Sum_Down[1] >= 3 Then Begin Plot1(Signal,"FP/HRFP",Black); SetPlotBGColor(1,Red); End Else If Sum_Up[1] = 2 Then Begin Plot1(Signal,"FP/HRFP", rgb(155,155,155)) ; // cross up = 2 set plot color to pale green or pink SetPlotBGColor(1, rgb(176,255,176)); End Else if Sum_Down[1] = 2 Then Begin Plot1(signal,"FP/HRFP", rgb(155,155,155)) ; SetPlotBGColor(1, rgb(255,176,176)); End } Else Noplot(1); End;
Re: TradeStation HRFP August 27, 2014 10:51PM |
Registered: 9 years ago Posts: 271 |
Re: TradeStation HRFP August 28, 2014 02:49AM |
Registered: 10 years ago Posts: 615 |
Re: TradeStation HRFP August 28, 2014 08:20AM |
Registered: 9 years ago Posts: 271 |
{ Indicator Flags } MA_UP( 0 ), MA_Down( 0 ), SRSI_UP( 0 ), SRSI_Down( 0 ), MACD_UP( 0 ), MACD_Down( 0 ), DMI_Up( 0 ), DMI_Down( 0 ), Sum_Up( 0 ), Sum_Down( 0 ), Signal("" ),
Re: TradeStation HRFP August 28, 2014 09:43AM |
Registered: 9 years ago Posts: 271 |
Re: TradeStation HRFP September 29, 2018 02:24AM |
Registered: 5 years ago Posts: 1 |
Re: TradeStation HRFP September 30, 2018 07:14PM |
Registered: 9 years ago Posts: 271 |