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 »


NewMax: Indicator Documentation

Syntax


DataSeries NewMax( DataSeries series, int period )

Parameter Description

series A price series
period Lookback period for indicator calculation

Description

NewMax


by DrKoch www.finantic.de 2004-06-22

This indicators finds new highs and new lows.
The value walks between -100 and +100.
If Price action reaches a new high relative to period Bars, the NewMax indicator is +100.
If Price action reaches a new low, the NewMax Indicator is -100.


Example

This example illustrates how to plot the NewMax indicator and trade using it, based on a WL4 chartscript by Dr.Koch called "NewMax Trader". It enters a new trade as soon as a new High or Low is found. It exits if the NewMax Indicator goes back from +100 / -100 to +95 / -95.


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 NewMaxStrategy : WealthScript { private StrategyParameter paramperiod; private StrategyParameter paramexit_limit; public NewMaxStrategy() { paramperiod = CreateParameter( "period", 24, 5, 50, 5 ); paramexit_limit = CreateParameter( "exit_limit", 95, 90, 100, 1 ); } protected override void Execute() { LineStyle ls = LineStyle.Solid; int period = paramperiod.ValueInt; double exit_limit = paramexit_limit.Value; // Indicators NewMax new_high_s = NewMax.Series( High,period ); NewMax new_low_s = NewMax.Series( Low,period ); // Graphics HideVolume(); ChartPane newm_p = CreatePane( 50, false, true ); SetPaneMinMax(newm_p, -100, 100);

PlotSeries( newm_p, new_high_s, Color.Green, ls, 1 ); // New High PlotSeries( newm_p, new_low_s, Color.Red, ls, 1 ); // New Low // Trading for(int bar = 20; bar < Bars.Count; bar++) { if (!IsLastPositionActive) { if( new_high_s[bar] >= 100.0 ) ShortAtMarket( bar+1, "new high" ); if( new_low_s[bar] <= -100.0 ) BuyAtMarket( bar+1, "new low" ); } else { Position p = LastPosition; if( ( p.PositionType == PositionType.Long ) & ( new_high_s[bar] >= -exit_limit ) ) SellAtMarket( bar+1, p, "end of uptrend" ); if( ( p.PositionType == PositionType.Short ) & ( new_low_s[bar] <= exit_limit ) ) CoverAtMarket( bar+1, p, "end of downtrend" ); } } } } }

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.