QStick

Modified on 2008/05/03 09:13 by Administrator — Categorized as: Standard Indicators

Syntax

public QStick(Bars bars, int period, string description)
public static QStick Series(Bars bars, int period)

Parameter Description

bars The Bars object
period Indicator calculation period

Description

QStick provides a way to quantify candlestick values. The QStick indicator is calculated by taking a moving average of the difference between open and closing prices.

Interpretation

When QStick crosses above zero, this is considered bullish, and below zero bearish. You can also look for extreme QStick levels to determine overbought and oversold levels, or look for divergences between QStick and price to signal trend reversals.

Example

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

namespace WealthLab.Strategies { public class MyStrategy : WealthScript { protected override void Execute() { // See how good the QStick zero line entry rule really is

double stop = 0; double profit = 0; double ep = 0; DataSeries qs = QStick.Series( Bars, 24 ); ChartPane QStickPane = CreatePane( 50, true, true ); PlotSeries( QStickPane, qs, Color.DarkBlue, WealthLab.LineStyle.Solid, 2 ); for(int bar = 24; bar < Bars.Count; bar++) { if( CrossOver( bar, qs, 0 ) ) BuyAtMarket( bar+1 ); if( CrossUnder( bar, qs, 0 ) ) ShortAtMarket( bar+1 );

for (int p = ActivePositions.Count - 1; p > -1; p-- ) { Position pos = ActivePositions[p]; ep = pos.EntryPrice; stop = ( pos.PositionType == PositionType.Long ) ? ep*0.8 : ep*1.2; profit = ( pos.PositionType == PositionType.Long ) ? ep*1.1 : ep*0.9; if( !ExitAtStop( bar+1, pos, stop, "Stop Loss" ) ) ExitAtLimit( bar+1, pos, profit, "Profit Target" ); } } } } }