Skip to content

Commit

Permalink
regenerated java with IMI
Browse files Browse the repository at this point in the history
  • Loading branch information
weltling committed Apr 3, 2013
1 parent 3f8c988 commit 557c9b0
Showing 1 changed file with 55 additions and 5 deletions.
60 changes: 55 additions & 5 deletions ta-lib/java/src/com/tictactec/ta/lib/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -15134,7 +15134,7 @@ public int imiLookback( int optInTimePeriod )
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return -1;
return 0;
return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Imi.ordinal()]) - 1;
}
public RetCode imi( int startIdx,
int endIdx,
Expand All @@ -15145,6 +15145,7 @@ public RetCode imi( int startIdx,
MInteger outNBElement,
double outReal[] )
{
int lookback, outIdx = 0;
if( startIdx < 0 )
return RetCode.OutOfRangeStartIndex ;
if( (endIdx < 0) || (endIdx < startIdx))
Expand All @@ -15153,8 +15154,32 @@ public RetCode imi( int startIdx,
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return RetCode.BadParam ;
outBegIdx.value = 0 ;
outNBElement.value = 0 ;
lookback = imiLookback ( optInTimePeriod );
if(startIdx < lookback)
startIdx = lookback;
if( startIdx > endIdx ) {
outBegIdx.value = 0 ;
outNBElement.value = 0 ;
return RetCode.Success ;
}
outBegIdx.value = startIdx;
while (startIdx <= endIdx) {
double upsum = .0, downsum = .0;
int i;
for (i = startIdx - lookback; i <= startIdx; i++) {
double close = inClose[i];
double open = inOpen[i];
if (close > open) {
upsum += (close - open);
} else {
downsum += (open - close);
}
outReal[outIdx] = 100.0*(upsum/(upsum + downsum));
}
startIdx++;
outIdx++;
}
outNBElement.value = outIdx;
return RetCode.Success ;
}
public RetCode imi( int startIdx,
Expand All @@ -15166,6 +15191,7 @@ public RetCode imi( int startIdx,
MInteger outNBElement,
double outReal[] )
{
int lookback, outIdx = 0;
if( startIdx < 0 )
return RetCode.OutOfRangeStartIndex ;
if( (endIdx < 0) || (endIdx < startIdx))
Expand All @@ -15174,8 +15200,32 @@ public RetCode imi( int startIdx,
optInTimePeriod = 14;
else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) )
return RetCode.BadParam ;
outBegIdx.value = 0 ;
outNBElement.value = 0 ;
lookback = imiLookback ( optInTimePeriod );
if(startIdx < lookback)
startIdx = lookback;
if( startIdx > endIdx ) {
outBegIdx.value = 0 ;
outNBElement.value = 0 ;
return RetCode.Success ;
}
outBegIdx.value = startIdx;
while (startIdx <= endIdx) {
double upsum = .0, downsum = .0;
int i;
for (i = startIdx - lookback; i <= startIdx; i++) {
double close = inClose[i];
double open = inOpen[i];
if (close > open) {
upsum += (close - open);
} else {
downsum += (open - close);
}
outReal[outIdx] = 100.0*(upsum/(upsum + downsum));
}
startIdx++;
outIdx++;
}
outNBElement.value = outIdx;
return RetCode.Success ;
}
/* Generated */
Expand Down

0 comments on commit 557c9b0

Please sign in to comment.