Log in to see Cloud of Tags

Wealth-Lab Wiki

TASC 2012-03 | Swami Stochastics Heat Map (Ehlers)

RSS

Traders' Tip text

Wealth-Lab 6’s C# translation of the EL code is shown below and is conveniently available for customers through the Strategy Download feature. Discretionary traders using technical analysis could find some value using the Swami Stochastics heat map to determine entry points in ongoing trends. “While no Swami expert am I” (think of Yoda when reading that), it’s my perception that main trend may be better identified using higher scales, like Weekly. Then look to the Swami heatmap at a lower scale, like Daily, to enter a trade when a countertrend move begins to dissipate, i.e., when the green starts appearing at the bottom of the Swami pane and correlates to a break in an identifiable resistance area, as shown in Figure 1.


Image
Figure 1. Apple Inc. Daily and Weekly (inset) Swami Stochastics showing trade opportunities after consolidative pullbacks.


Tip: Don't copy! Instead, use the Strategy Download feature in the Strategy Explorer (Ctrl+O)

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

namespace WealthLab.Strategies { public class SwamiStochastics : WealthScript { StrategyParameter _plotWidth; public SwamiStochastics() { _plotWidth = CreateParameter("Plot Width", 6, 2, 10, 1); } public class ArrayHolder { internal double Stoc, Num, Denom; } public void SwamiStochHeatMap(DataSeries ds, int plotThickness) { int r = 0; int g = 0; int b = 0; string s = ds.Description + ")"; DataSeries swStoch = new DataSeries(ds, "SwamiStoch(" + s); DataSeries">49"> swamistoch = new DataSeries[49; // Initialize array ArrayHolder">49"> ah = new ArrayHolder[49; for( int n = 4; n < 49; n++ ) ahn = new ArrayHolder(); // Create and plot the heatmap series (change bar colors later) HideVolume(); HidePaneLines(); ChartPane swPane = CreatePane(50, false, false ); for( int n = 4; n < 49; n++ ) { swamistochn = swStoch + n; swamistochn.Description = "SwamiSto." + n.ToString(); PlotSeries(swPane, swamistochn, Color.LightGray, LineStyle.Solid, plotThickness); } for(int bar = 48; bar < Bars.Count; bar++) { double num2, denom2, stoch2;

for (int n = 4; n < 49; n++) { num2 = ahn.Num; denom2 = ahn.Denom; stoch2 = ahn.Stoc; double hh = 0; double ll = 1e10; for (int j = 0; j < n; j++) { if (dsbar - j > hh) hh = dsbar - j; if (dsbar - j < ll) ll = dsbar - j; } ahn.Num = 0.5 * (dsbar - ll) + 0.5 * num2; ahn.Denom = 0.5 * (hh - ll) + 0.5 * denom2; if (ahn.Denom != 0) { ahn.Stoc = 0.2 * (ahn.Num / ahn.Denom) + 0.8 * stoch2; } if (ahn.Stoc >= 0.5) { r = Convert.ToInt32(255 * (2 - 2 * ahn.Stoc)); g = 255; } else { r = 255; g = Convert.ToInt32(255 * 2 * ahn.Stoc); } SetSeriesBarColor(bar, swamistochn, Color.FromArgb(r, g, b)); } } } protected override void Execute() { SwamiStochHeatMap(Close, _plotWidth.ValueInt); } } }

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.


ScrewTurn Wiki. Some of the icons created by FamFamFam.