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 »


TASC 2011-08 | Automated Techniques For Intraday Traders (Coles)

RSS

Traders' Tip text

Wealth-Lab users are welcome to give these two time-based techniques a try and turn their screens into drawing boards. The code is available for instant download from Wealth-Lab's "Open Strategy" dialog. An additional library, “Community Components”, also available for download to Wealth-Lab customers from our site www.wealth-lab.com (Extensions section), is required for the strategy to function.


Image

Figure 1. A Wealth-Lab Developer 6.2 chart showing the Fibonacci/Lucas bar chart markup applied to a Daily chart of AAPL (Apple Inc).


Users should be aware that with methods without a rock solid starting point, it's an open question whether does automating line placement on the chart removes the subjectivity. Our example strategy automates finding the starting point on the chart of any time frame by searching for the recent 10% peak or trough (whichever happened later) – the percentage is configurable by dragging the "Reversal %" slider in the bottom left part of the screen.

One thing's for sure: If you draw enough lines on a chart, some of them are bound to hit important turning points.

WealthScript Code (C#)


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 FibLucas : WealthScript { private StrategyParameter paramAmount; int[] fib = new int[] {5,8,13,21,34,55,89,144,233,377,610,987,1597,2584,4181,6765}; int[] lucas = new int[] {3,4,7,11,18,29,47,76,123,199,322,521,843,1364,2207,3571}; Font font = new Font("Wingdings", 8, FontStyle.Bold); Font font2 = new Font("Verdana", 7, FontStyle.Regular); string upArrow = Convert.ToChar(0x00E9).ToString(); string dnArrow = Convert.ToChar(0x00EA).ToString(); public FibLucas() { paramAmount = CreateParameter("Reversal %", 10, 2, 50, 1); } // Marking bars private void Highlighter( int[] array, double barsSince, int bar, Color color) { for( int i = 0; i < array.GetLength(0); i++ ) { if( barsSince == array[i] ) { AnnotateBar(upArrow, bar, false, color, Color.Transparent, font); AnnotateBar(array[i].ToString(), bar, false, color, Color.Transparent, font2); SetBarColor( bar, color ); break; } } } protected override void Execute() { // Variable definition, series creation and array initialization PeakTroughMode pct = PeakTroughMode.Percent; double amt = paramAmount.Value; Peak p = Peak.Series( High, amt, pct ); PeakBar pb = PeakBar.Series( High, amt, pct ); Trough t = Trough.Series( Low, amt, pct ); TroughBar tb = TroughBar.Series( Low, amt, pct ); Calculate c = new Calculate(this); // pass an instance of the WealthScript object DataSeries barsSince = new DataSeries(Bars,"Bars Since Start"); int markbar = -1; int init = -1; SetBarColors( Color.Silver,Color.Silver ); HideVolume(); // Build auxiliary binary wave DataSeries start = new DataSeries( Bars, "start" ); for(int bar = Bars.Count-1; bar >= 0; bar--) { int i = Math.Max( (int)tb[bar], (int)pb[bar] ); if( i > -1 ) { start[i] = i; init = i; break; } else start[i] = -1; } for(int bar = init; bar < Bars.Count; bar++) { // Building BarsSince series if( c.BarsSince( bar, CrossOver(bar, start, 0) ) == 0) markbar = bar; if( markbar > 0 ) barsSince[bar] = bar - markbar; // Marking Fibonacci/Lucas bars Highlighter( fib, barsSince[bar], bar, Color.Blue ); Highlighter( lucas, barsSince[bar], bar, Color.Red ); } } } }

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.