Thursday, September 09, 2010

Indicator Overbought / Oversold [IOO]

Descripton
Summary:
This analyst script is used to determine whether an underlying indicator is overbought or oversold.

Values:
1. 0 - Not overbought or oversold.
2. -100 - Overbought.
3. 100 - Oversold.


Variables
TypeIdentifierDescription
Integer_analyzedIndicatorKeyUse for the indicator key to analyze for overbought and oversold conditions.
Number_overboughtValueUse for the minimum value above which the underlying indicator is considered overbought.
Number_oversoldValueUse for the minimum value below which the underlying indicator is considered oversold.

OnAnalysis
Function Parameters
TypeIdentifierDescription
IntegerbarIndex
Implementation
	Define value As Number = IndicatorValue(_analyzedIndicatorKey, barIndex)
	 ' Check for an overbought condition.
	If (value > _overboughtValue) Then
		Return -100
	End If
	 ' Check for an oversold condition.
	If (value < _oversoldValue) Then
		Return 100
	End If
	
	Return 0

OnInitialize
Function Parameters
TypeIdentifierDescription
IndicatoranalyzedIndicatorKeyUse for the indicator key to analyze for overbought and oversold conditions.
NumberoverboughtValueUse for the minimum value above which the underlying indicator is considered overbought. [Default 80]
NumberoversoldValueUse for the minimum value below which the underlying indicator is considered oversold. [Default 20]
Implementation
	 ' Assign the script parameters to script variables.
	_analyzedIndicatorKey = analyzedIndicatorKey
	_overboughtValue = overboughtValue
	_oversoldValue = oversoldValue

Copyright © 2010 IQBroker, LLC. All rights reserved.