Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

TradeStation HRFP

Posted by NCTrader 
TradeStation HRFP
August 27, 2014 10:46PM
For those that have asked below is a very basic FP/HRFP indicator (Analysis Technique) for TradeStation. It is not intended to be an end all / be all high performance sports car that satisfies everyone. Just an example and food for thought on how it can be done. This particular version is specifically designed for RadarScreen. There are a few caveats to be aware of:

1. Logic is designed for a strict crossing now approach. Be advised that it is possible for one value to "limp" across another to the point it cannot be seen by the naked eye. If a value goes from 0.01 below to 0.01 above it counts as a cross. That does not mean you should count it but the indicator will.

2. I was going to provide the ELD but cannot figure out how to include an attachment. My testing is based on setting "Update value intra-bar" to off (unchecked) on General tab. You also need to load additional bars for indicators to calculate correctly (I always use 500 as a default but you should not need more than 100 or so). All basic TS user functionality that you should know. If, however, you select "update value intra-bar" to on (checked) then all signals will occur one candle earlier (while the candle is forming - not when it closes). Play around with it but there are pros and cons either way. I suggest starting with intra-bar off.

3. The indicator provides two types of signals. FP/HRFP denoted by dark/bright red or green. You will also receive a weak signal if 2 cross using pink or pale green. Some might find it useful. I can think of a few reasons someone might want this functionality.

4. There is an option where you can consider signals on the last closed candle and the candle before (crossing over the past two candles). Read the notes within the code. This functionality has been commented out for now but there are instructions on how to use.

5. I purposely removed all indicator settings. You are responsible for adding the correct settings under user inputs when you add the Analysis Technique. There should be enough notes when you get to the screen to guide you through the process.

6. Methodology is based on the old FP/HRFP thought process. I purposely left out any items that make SLI uniquely different from HRFP as well any reference to DE. This is pure 1-5. That said there are pieces of code that were left in to make it easier to modify for SLI if you desire. There are also easier ways to write the code but I chose this structure because it works for me and provides flexibility to do other things.

7. This is for informational purposes only and I accept no responsibility for your results. The is an example of how it can be done. As I stated in other posts I find it more beneficial when I can be "one with the charts" and make decisions manually. At times my schedule does not always allow so I use similar tools to point me in the right direction.

Hope it helps. If someone can tell me how to post the ELD I will be more than happy to do so.

{*********************************************************************
 *** 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(""winking smiley,				
	
	
	{ 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;


Happy Trading!

NCT
Re: TradeStation HRFP
August 27, 2014 10:51PM
Quick snapshot of what it looks like depending on how you have RS configured. Pinkish color denotes 2 crossings on the particular chart. Bright green = 3 or more. The only thing you cannot see are the bright red for 3 or more down or pale green for 2 up.

Re: TradeStation HRFP
August 28, 2014 02:49AM
That's a nice bit of code you've got there, NCTrader. I use TOS because I'm a long-time Mac user and am unwilling to make the switch to Windows. However, it is my understanding, as evidenced above, that TradeStation utilizes a much more robust scripting language that allows for greater possibilities. That does intrigue me. Perhaps one day I'll outgrow TOS (which does have quite a few quirks and limitations) and make the switch (at least in my trading room) to a windows machine so that I can use the TS platform.

Even though I can't use your codes, I would be interested in seeing more from you if only to stimulate ideas for my own scripting. Well done.
Re: TradeStation HRFP
August 28, 2014 08:20AM
Thanks Robert! Some of the die hard TS programmers would argue that TS Easy Language became its own self contained full fledged programming language a few years ago. I am not in a position to say. From what I read the original designer(s) based it on old Pascal. Most things are possible depending on ones level of commitment to learn. The true programmers out there that are unable to do things easily in TS EL program in something like C# , create their own dll, and use TS EL in order to link to the dll. Interesting to see what others are doing in the community forums but a bit beyond my expertise. Special thanks to you for sharing your ideas as it has inspired me to play around and see what is easily doable in TS w/out too much effort.

For anyone that does not like the winking smiley in my original post the Indicator Flag section should be as follows:

	{ 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("" ),


Happy Thursday!

NCT
Re: TradeStation HRFP
August 28, 2014 09:43AM
FYI.. visual example of other easy possibilities. I am not currently using this but I tested setting up some of Darcy's stuff. The believe what I have circled is the type of set up Darcy is looking for across multiple charts: FP/HRFP with E signal occurring about the same time. In this case the FP/HRFP occurred on one candle and E on the very next. The red vertical line denotes FP/HRFP but actual indicators are not shown. Drawing arrows requires advanced coding but I can add an E that corresponds with the signal. If anyone is interested I can see about resurrecting this code. It might take a few days as I need to clean up the code and ensure it is NDA compliant.

Re: TradeStation HRFP
September 29, 2018 02:24AM
Hello, I will like to know if its possible that the values can be add to the study so it can work, its missing the values.
Or if you can provide me the values .
many thanks for your support
Re: TradeStation HRFP
September 30, 2018 07:14PM
Sorry Oscar but no can do. First, many of us in the forum attended trading classes from the same instructor. Part of the course is providing the indicator settings, rules, etc. and how to put it all together. We all signed an NDA which also includes indicator settings. I intentionally provided w/out the settings so that folks could use whatever they wanted. Those they know the GW system already have the settings for the main indicators. The "E" signal as mentioned in this forum is a simple 3 MA crossover. You can use whatever you want.

Second, I'm not sure if it would do any good. Several folks have indicated some of the code I provided as referenced above no longer works due to recent updates in TS. I rarely touch TS any more and therefore don't know off the top of my head what to suggest. It shouldn't be hard to figure out if you have time to search the forums. If I get a chance in the foreseeable future, I'll see if I can spend some time reacquainting myself with the changes in TS and update code accordingly. I try to stay away as I can loose an entire weekend playing around inside TS dev environment when I should be focused on things that help make me better at trading.

Best of luck!
Sorry, only registered users may post in this forum.

Click here to login