Wealth-Lab Wiki

API ChartStyles Community Components Community Indicators IndexDefinitions Knowledge Base Misc Optimizers Pending Deletion PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation


Quick Search
»
Advanced Search »


Negative Closes

RSS

Negative Closes: Indicator Documentation

Syntax

DataSeries NegativeCloses( DataSeries ds, int Lookback )

Parameter Description

dsData series
LookbackThe number of bars over which to count negative closes.

Description

A "negative close" occurs when the value of the DataSeries is lower than it was on the previous bar. This indicator returns the total number of negative closes over the specified lookback period. Also see: Positive Closes

Note! Version 2010.10 of Community Indicators contains a breaking change: replaced Bars parameter with DataSeries.

Example

Example based on version 2010.10 of Community Indicators.


using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
using Community.Indicators;

namespace WealthLab.Strategies { public class ClosesStrategy : WealthScript { protected override void Execute() { DataSeries pc = PositiveCloses.Series( Close, 3 ); DataSeries nc = NegativeCloses.Series( Low, 5 ); ChartPane closesPane = CreatePane( 25, true, true ); PlotSeries( closesPane, pc, Color.Blue, LineStyle.Solid, 2 ); PlotSeries( closesPane, nc, Color.Red, LineStyle.Solid, 2 ); for(int bar = 5; bar < Bars.Count; bar++) { if (IsLastPositionActive) { // Sell when the last 2 of 3 closes are higher if (pc[bar] >= 2) ExitAtMarket(bar + 1, LastPosition); } else { // Buy when the last 4 of 5 lows are lower if (nc[bar] >= 4) BuyAtMarket(bar + 1); } } } } }

Important Disclaimer: The information provided by Wealth-Lab is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security.  The owner of Wealth-Lab.com assumes no liability resulting from the use of the material contained herein for investment purposes. By using this web site, you agree to the terms of this disclaimer and our Terms of Use.

Used under license from FMR Corp. Copyright 2008 FMR Corp. All rights reserved.


ScrewTurn Wiki. Some of the icons created by FamFamFam.