using System; using WealthLab; using WealthLab.Rules.Candlesticks; namespace WealthLab.Strategies { public class CandlePatternStrategy : WealthScript { protected override void Execute() { bool[] bullishDojiStar; CandlePattern.BullishDojiStar(this, "+Doji Star", true, out bullishDojiStar); bool[] bullishInvertedHammer; CandlePattern.BullishInvertedHammer(this, "+Inverted Hammer", true, out bullishInvertedHammer); bool[] bearishThreeBlackCrows; CandlePattern.BearishThreeBlackCrows(this, "-3Black Crows", true, out bearishThreeBlackCrows); bool[] bearishTriStar; CandlePattern.BearishTriStar(this, "-Tri Star", true, out bearishTriStar); for (int bar = 25; bar < Bars.Count; bar++) { if (IsLastPositionActive) { Position p = LastPosition; if (bearishThreeBlackCrows[bar] || bearishTriStar[bar]) SellAtMarket(bar + 1, p); } else { if (bullishDojiStar[bar]) BuyAtMarket(bar + 1); } } } } }