Welcome! Log In Create A New Profile

Get Earnings and Seasonal Trends - Subscribe Today!

Advanced

TS RadarScreen "E"

Posted by NCTrader 
TS RadarScreen "E"
May 11, 2015 09:31PM
I was asked earlier if this was possible. This is quick down and dirty solution created by recycled code. It should get you started. Added E Signal indicator to RadarScreen, removed everything other than interval and E indicator, and used "snaking" for side-by-side. If you do not want to see the intervals and want to see the signals side-by-side that is possible as well but you cannot add column labels. You will have to remember what the columns stand for. As I said it will get you started. Yellow denotes that the MAs are not in correct alignment for either direction (e.g., 10 > 5 > 20). You also have the flexibility to choose the type of MA you want to use. As always inputs have been removed - you must decide.




{***************************************************************
 *** TS RadarScreen 3 MA cross                               ***
 *** Allows user to define MA type and length.               ***
 *** 5/11/2014 by NCT                                        ***
 **************************************************************}

Inputs:
	MA_Type( 1 {1=SMA, 2=EMA}) ,
	MA_Short( 0 ) ,
	MA_Medium( 0 ) ,
	MA_Long( 0 ) ;
	
Var:
	MA_S( 0 ) ,
	MA_M( 0 ) ,
	MA_L( 0 ) ,

	
	{ Application Identifier }
	RS( GetAppInfo(aiApplicationType) = 2 ) ,            // True if indicator inserted in a Radarscreen
	Chart( GetAppInfo(aiApplicationType) = 1 ) ;         // True if indicator inserted in a chart		
	
	
{  --- Calculate Moving Averages --- }

If MA_Type = 1 Then
	Begin
		MA_S = AverageFC(Close,MA_Short) ;
		MA_M = AverageFC(Close,MA_Medium) ;
		MA_L = AverageFC(Close,MA_Long) ;
	End
Else If MA_Type = 2 Then
	Begin
		MA_S = XAverage(Close,MA_Short) ;
		MA_M = XAverage(Close,MA_Medium) ;
		MA_L = XAverage(Close,MA_Long) ;	
	End			
Else
	RaiseRunTimeError("Invalid moving average type.  Please select 1 for simple or 2 for exponential" ) ;
	
{ --- Plot Signal:  RadarScreen ---}


If RS Then
	Begin

		If MA_S > MA_M AND MA_M > MA_L Then
			Begin
				Plot1("","ESig",rgb(100,100,100)) ;
				SetPlotBGColor(1,rgb(111,255,111)) ;
			End

		Else if MA_S < MA_M AND MA_M < MA_L	Then
			Begin
				Plot1("","ESig",rgb(100,100,100)) ;
				SetPlotBGColor(1,rgb(255,108,108)) ;
			End
		Else
			Begin
				Plot1("","ESig",rgb(255,255,165));
				SetPlotBGColor(1,rgb(255,255,165)) ;
			End;
	End;	
Re: TS RadarScreen "E"
May 12, 2015 01:46AM
NCTrader,

Please allow me to geek out for a moment. That is some beautifully formatted code. grinning smiley The TS scripting language seems to be much more robust than ThinkScript.

- robert


Professional ThinkorSwim indicators for the average Joe
Re: TS RadarScreen "E"
May 12, 2015 07:08AM
NCtrader:

SwEEEEEEEt !

Thank you kindly. Your contributions are extremely helpful.

Chunk
Re: TS RadarScreen "E"
May 12, 2015 07:56AM
Robert,

Thank you! Your work on TOS has been my inspiration to see what TS can do. Unfortunately robustness also brings various nuances. I envy the way you can test for "Not True" by using an exclamation in front of a condition. In TS I would have to test against "False" or create a custom function that does the test for me. Either way it is more work. On the positive side there is an entire community of "Roberts" out there pushing the envelope to see what they can do along with TS Engineers that are pretty responsive to questions. If you have a coding background to he point of creating your own DLLS then you have more flexibility to write what you want outside of Easy Language and call the DLLs within EL. Pretty sweet but far beyond my capabilities.


Chunk,

Glad I could help! You probably already know this but TS has a built in indicator to easily create the E-Chart called moving average 3 lines. Default settings are 4,9,18. I only mention this for anyone that happens to read this thread. Typically if TS provides a built in indicator like that then said indicator already has the code in place to set an alert. Therefore you can have your E visually displayed on the charts, RadarScreen configured similar to the above screen short, and have an alert set on your chart. I do not currently use the E -chart but thought I would throw out what should be possible.

NCT
Sorry, only registered users may post in this forum.

Click here to login