Syntax
public CumUp(DataSeries source, int period, string description)
public static CumUp Series(WealthLab.DataSeries source, int period)
public static double Value(int bar, DataSeries source, int period)
Parameter Description
source |
Price series |
period |
Indicator calculation period |
Description
CumUp lets you test whether a specific number of consecutive bars have elapsed where the prices are greater than their value a certain number of bars ago. See also:
CumDownCalculation
CumUp is a running count of the number of bars whose Series value is above its delayed Series; in other words, Series offset forward by the Period. The count is reset to zero when the Series is below its offset series.
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
// Thank you fundtimer
public Color WS4ColorToNET( double WS4Color )
{
return Color.FromArgb(
(int)Math.Floor( ( WS4Color % 1000 ) / 100 * 28.4 ),
(int)Math.Floor( ( WS4Color % 100 ) / 10 * 28.4 ),
(int)Math.Floor( WS4Color % 10 * 28.4 ) );
}
protected override void Execute()
{
// Highlight extreme moves up
double n = 0;
for(int bar = 0; bar < Bars.Count; bar++)
{
n = Math.Truncate( CumUp.Series( Close, 3 )bar );
if( n > 9 ) n = 9;
SetBarColor( bar, WS4ColorToNET( n*10 ) );
}
}
}
}