UpBar Returns 1 if the bar is an UpBar, 0 if not. You define what an 0
Posted on 17, June 2013
in Category SID
Description for UpBar SID 994
UpBar Returns 1 if the bar is an UpBar, 0 if not. You define what an UpBar is by specifying one or more columns as arguments. If you want to look for higher highs, then specify UpBar(High). If you require an UpBar to be both higher highs and higher lo
The logic for this technical analysis indicator:
#UpBar # # Returns 1 if the bar is an upbar, 0 if not. # # Accepts up to four columns as arguments. Only one column is compulsory. For the bar to be considered an upbar, # all of the passed arguments must have a value greater than the value on the previous bar. # The use of optional paramters allows this indicator to flag higher highs, or higher highs and higher lows, for example. # Passing one column (e.g. Low) just looks for higher lows. Passing (High,Low) returns 1 if both the high and low are higher. my ($Column1, $Column2, $Column3, $Column4) = @_; my $NumColumns = 1; ValidateColumns($Column1); my $UpCount = 0; $UpCount = If ($Column1 > Ref($Column1,-1),$UpCount = $UpCount + 1,0); if ($Column2 > 0) { ValidateColumns($Column2); $NumColumns = $NumColumns + 1; $UpCount = If ($Column2 > Ref($Column2,-1),$UpCount = $UpCount + 1,0); } if ($Column3 > 0) { ValidateColumns($Column3); $UpCount = If ($Column3 > Ref($Column3,-1),$UpCount = $UpCount + 1,0); $NumColumns = $NumColumns + 1; } if ($Column4 > 0) { ValidateColumns($Column4); $UpCount = If ($Column4 > Ref($Column4,-1),$UpCount = $UpCount + 1,0); $NumColumns = $NumColumns + 1; } my $UpBar = If($UpCount == $NumColumns,1,0);
0 Comments