ScrewTurn

Active Trader Strategies API Community ChartStyles Community Commissions Community Components Community Indicators Knowledge Base Misc Optimizers PosSizers Providers Standard Indicators TASC Traders Tips TASCIndicators Tutorial Videos Visualizers
RSS

Navigation







Quick Search
»
Advanced Search »

PoweredBy

Syntax


public bool CrossOverWithin(int bar, DataSeries Series1, DataSeries Series2, int WithinBars)

Parameter Description

bar Bar
Series1 First data series
Series2 Second data series
WithinBars Within N bars

Description

Returns true for the specified bar if Series1 has crossed over Series2 within the specified number of WithinBars AND has not crossed below since the most-recent crossover event.

Original function created for WL4 by Robert Sucher.

Example


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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // create an instance of the SeriesHelper object SeriesHelper sh = new SeriesHelper(this); for(int bar = 20; bar < Bars.Count; bar++) { if (IsLastPositionActive) { //code your exit rules here } else { if (sh.CrossOverWithin (bar, Close, SMA.Series(Close,20), 5)) 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.

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


ScrewTurn Wiki version 3.0.2.509. Some of the icons created by FamFamFam.