- UID
- 2
- 积分
- 2874634
- 威望
- 1387346 布
- 龙e币
- 1487288 刀
- 在线时间
- 13156 小时
- 注册时间
- 2009-12-3
- 最后登录
- 2024-11-24
|
【RS_DailyDataArray】
- inputs:
- NumDays( numericsimple ),
- oDataArray[ Twelve, MaxNumDays ]( numericarrayref ),
-
- oIndex( numericref ),
- oSubArray[ Three ]( numericarrayref ) ;
-
- variables:
- var0( BarType ),
- var1( 0 ),
- var2( 0 ),
- var3( 0 ),
- var4( 0 ),
- var5( 0 ) ;
- //if var0 <> 1 then
- // RaiseRuntimeError( "Invalid interval. This indicator requires intraday data." ) ;
- if NumDays < 1 or NumDays > MaxNumDays then
- RaiseRuntimeError( "NumDays out of range." ) ;
- var1 = CurrentBar ;
- if CurrentBar = 1 then
- begin
- var2 = ( NumDays + 5 ) * RS_BarsPerDay ;
-
- for var3 = var2 downto 0
- begin
- condition1 = Date[var3] <> Date[var3+1] ;
- if condition1 then
- begin
- var4 = var4 + 1 ;
-
-
- oDataArray[ 4, oIndex ] = Close[var3+1] ;
- oDataArray[ 6, oIndex ] = ( oDataArray[ 2, oIndex ] + oDataArray[ 3,
- oIndex ] ) * .5 ;
- oDataArray[ 7, oIndex ] = MaxList( oDataArray[ 2, oIndex ],
- var5 ) ;
- oDataArray[ 8, oIndex ] = MinList( oDataArray[ 3, oIndex ],
- var5 ) ;
- oDataArray[ 9, oIndex ] = oDataArray[ 7, oIndex ] - oDataArray[ 8,
- oIndex ] ;
- var5 = Close[var3+1] ;
-
- oIndex = oIndex - 1 ;
- if oIndex = -1
- then oIndex = MaxNumDays ;
-
-
- oDataArray[ 1, oIndex ] = Open[var3] ;
- oDataArray[ 2, oIndex ] = High[var3] ;
- oDataArray[ 3, oIndex ] = Low[var3] ;
-
- oDataArray[ 5, oIndex ] = Ticks[var3] ;
-
-
-
-
- oDataArray[ 10, oIndex ] = 1-var3 ;
- oDataArray[ 11, oIndex ] = 1-var3 ;
- oDataArray[ 12, oIndex ] = var4 ;
- end
- else if var4 > 0 then
- begin
- condition1 = High[var3] > oDataArray[ 2, oIndex ] ;
- if condition1 then
- begin
- oDataArray[ 2, oIndex ] = High[var3] ;
- oDataArray[ 10, oIndex ] = 1-var3 ;
- end ;
- condition1 = Low[var3] < oDataArray[ 3, oIndex ] ;
- if condition1 then
- begin
- oDataArray[ 3, oIndex ] = Low[var3] ;
- oDataArray[ 11, oIndex ] = 1-var3 ;
- end ;
- oDataArray[ 5, oIndex ] = oDataArray[ 5, oIndex ] + Ticks[var3] ;
- end ;
- if var3 = 1 then
- begin
- oSubArray[1] = oDataArray[ 2, oIndex ] ;
- oSubArray[2] = oDataArray[ 3, oIndex ] ;
- oSubArray[3] = oDataArray[ 12, oIndex ] ;
- end ;
- end ;
- end
- else
- begin
- if Date <> Date[1] then
- begin
- var4 = var4 + 1 ;
-
-
- oDataArray[ 4, oIndex ] = Close[1] ;
- oDataArray[ 6, oIndex ] = ( oDataArray[ 2, oIndex ] + oDataArray[ 3,
- oIndex ] ) * .5 ;
- oDataArray[ 7, oIndex ] = MaxList( oDataArray[ 2, oIndex ], var5 ) ;
- oDataArray[ 8, oIndex ] = MinList( oDataArray[ 3, oIndex ], var5 ) ;
- oDataArray[ 9, oIndex ] = oDataArray[ 7, oIndex ] - oDataArray[ 8, oIndex ] ;
- var5 = Close[1] ;
-
- oIndex = oIndex - 1 ;
- if oIndex = -1
- then oIndex = MaxNumDays ;
-
-
- oDataArray[ 1, oIndex ] = Open ;
- oDataArray[ 2, oIndex ] = High ;
- oDataArray[ 3, oIndex ] = Low ;
-
- oDataArray[ 5, oIndex ] = Ticks ;
-
-
-
-
- oDataArray[ 10, oIndex ] = var1 ;
- oDataArray[ 11, oIndex ] = var1 ;
- oDataArray[ 12, oIndex ] = var4 ;
- end
- else if var4 > 0 then
- begin
- condition1 = High > oDataArray[ 2, oIndex ] ;
- if condition1 then
- begin
- oDataArray[ 2, oIndex ] = High ;
- oDataArray[ 10, oIndex ] = var1 ;
- end ;
- condition1 = Low < oDataArray[ 3, oIndex ] ;
- if condition1 then
- begin
- oDataArray[ 3, oIndex ] = Low ;
- oDataArray[ 11, oIndex ] = var1 ;
- end ;
- oDataArray[ 5, oIndex ] = oDataArray[ 5, oIndex ] + Ticks ;
- end ;
- end ;
- RS_DailyDataArray = 1 ;
复制代码 |
论坛官方微信、群(期货热点、量化探讨、开户与绑定实盘)
|