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 2017-10 | A Candlestick Strategy With Soldiers And Crows (D'Ambrosio, Star)

RSS

Traders' Tip text

The bullish one white soldier and bearish one black crow patterns have been added to our WealthLab.Rules.Candlesticks library for easy reference in users' Strategies. Here's the complete list of Strategy rules:

Enter long next bar at open if following conditions are met:
  • Stock price greater than $1
  • 50-day simple moving average of volume is greater than 100,000
  • Yesterday’s close was less than the day before
  • Yesterday’s close was less than its open
  • Today’s open is greater than yesterday’s close
  • Today’s close is greater than yesterday’s open
  • Today’s open is less than yesterday’s open
  • As of yesterday’s close, price had been closing lower for three days

Sell short next bar at open if following conditions are met:

  • Stock price is greater than $10
  • 50-day simple moving average of volume is greater than 100,000
  • Yesterday’s close was higher than the close the day before
  • Yesterday’s close was greater than yesterday’s open
  • Today’s open is less than yesterday’s close
  • Today’s close is less than yesterday’s open
  • Today’s open is higher than yesterday’s open
  • As of yesterday’s close, price had been closing higher for three days.

Exit long position if any condition is triggered:

  1. Exit at market on two lower lows
  2. Exit at market if either the 14-period Stochastic is at or above than 80 or the 14-period RSI is at or above 70
  3. Exit at a 3% stop loss (if enabled)
  4. Exit at a 5% take profit (if enabled)

Cover short position if any condition is triggered:

  1. Exit at market on two higher highs
  2. Exit at market if either the 14-period Stochastic is at or below 20 or the 14-period RSI is at or below 30
  3. Exit at a 3% stop loss (if enabled)
  4. Exit at a 5% take profit (if enabled)

Image

Figure 1. Application of the Strategy to AIG (American International Group).

Get the companion Strategy's C# code by downloading it right from Wealth-Lab's "Open Strategy" dialog. Strategy requires Community Components library installed and/or upgraded to v2017.09 or later:

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

//Requires CandlePattern Rules Class

namespace WealthLab.Strategies { public class TASC201710 : WealthScript { private StrategyParameter paramSL; private StrategyParameter paramTP; private StrategyParameter paramStops; public TASC201710() { paramStops = CreateParameter("Activate SL/PT",1,0,1,1); paramSL = CreateParameter("Stop %",3,1,10,1); paramTP = CreateParameter("Profit %",5,1,20,1); } protected override void Execute() { var sto = StochK.Series( Bars, 14 ); var rsi = RSI.Series( Close, 14 ); bool enableStopAndProfit = paramStops.ValueInt == 1 ? true : false; for(int bar = GetTradingLoopStartBar( 50 ); bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if( p.PositionType == PositionType.Long ) { var twoLowerLows = CumDown.Series( Low, 1)[bar - 1] >= 2; var overbot = (sto[bar] >= 80) || (rsi[bar] >= 70); double Stop = p.EntryPrice * (1 - paramSL.Value / 100d); double Profit = p.EntryPrice * (1 + paramTP.Value / 100.0d); if( twoLowerLows ) SellAtMarket( bar+1, p, "2 lows" ); else if( overbot ) SellAtMarket( bar+1, p, "Overbought" ); else if(enableStopAndProfit) { if(!SellAtStop( bar + 1, p, Stop, "Stop") ) SellAtLimit( bar + 1, p, Profit, "Profit" ); } } else { var twoHigherHighs = CumUp.Series( High ,1)[bar - 1] >= 2; var oversold = (sto[bar] <= 20) || (rsi[bar] <= 30); double Stop = p.EntryPrice * (1 + paramSL.Value / 100d); double Profit = p.EntryPrice * (1 - paramTP.Value / 100.0d); if( twoHigherHighs ) CoverAtMarket( bar+1, p, "2 highs" ); else if( oversold ) CoverAtMarket( bar+1, p, "Oversold" ); else if (enableStopAndProfit) { if(!CoverAtStop( bar + 1, p, Stop, "Stop") ) CoverAtLimit( bar + 1, p, Profit, "Profit" ); } } } else { //trend definition (define your own one) var trendBearish = CumDown.Series( Close, 1 )[bar - 1] >= 3; var trendBullish = CumUp.Series( Close, 1 )[bar - 1] >= 3;

//50-day average volume is greater than 100,000 var volume = SMA.Series( Volume, 50 )[bar] > 100000;

//Bullish one white soldier scan var soldier = this.isBullishOneWhiteSoldier(bar); var price1 = Close[bar] > 1.0; //Bearish one black crow scan var crow = this.isBearishOneBlackCrow(bar); var price10 = Close[bar] > 10.0; //Scans var BullishScan = trendBearish && volume && soldier && price1; var BearishScan = trendBullish && volume && crow && price10; double[] rectangle = { bar-4, Highest.Series(High, 3)[bar-1], bar-4, Lowest.Series(Low, 3)[bar-1], bar, Lowest.Series(Low, 3)[bar-1], bar, Highest.Series(High, 3)[bar-1] }; if( BullishScan ) { DrawPolygon( PricePane, Color.Transparent, Color.FromArgb(30, Color.Green), LineStyle.Solid, 2, true, rectangle ); BuyAtMarket(bar+1, "Bullish one white soldier"); } else if( BearishScan ) { DrawPolygon( PricePane, Color.Transparent, Color.FromArgb(30, Color.Red), LineStyle.Solid, 2, true, rectangle ); ShortAtMarket(bar+1, "Bearish one black crow"); } } } } } }

Eugene (Gene Geren)
Wealth-Lab team
www.wealth-lab.com

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.