- ago
Hi.
I want to define a doji as a Candlestick (CS) when Open differs from Close by 0,2% or less.
I don't want to trade on Dojis, and I want to exclude them from N bars ago.
Lets say I want to trigger a signal after 3 consecutive down days. I find 3 consecutive down days but one of them is a Doji. Then it should'nt trigger. Is this doable in Building Blocks?

2nd Scenario.
I find 3 consecutive down days, but one of them is a "green CS", meaning a CS where Close is higher than Open. It should'nt count as well.

Sometimes I like to count specific CS rather than consecutive Higher or Lower bars.

Example, find 3 latest green bars above indicator, not counting Dojis, Hammers, Red bars etc ..

Cheers.
0
408
Solved
9 Replies

Reply

Bookmark

Sort
Glitch8
 ( 10.62% )
- ago
#1
>>I want to define a doji as a Candlestick (CS) when Open differs from Close by 0,2% or less. I don't want to trade on Dojis, and I want to exclude them from N bars ago.
Lets say I want to trigger a signal after 3 consecutive down days. I find 3 consecutive down days but one of them is a Doji. Then it should'nt trigger. Is this doable in Building Blocks?<<

I added a new Condition to the Candlestick extension to facilitate this. It resolves to true if the current bar is NOT the selected Candlestick pattern. You can use the Candlestick Extension preferences to change the "Equality Thresold" to 0.2, then this will work. You'll need to wait for the next release cycle and Candlestick extension Build 9.

1
Glitch8
 ( 10.62% )
- ago
#2
>>I find 3 consecutive down days, but one of them is a "green CS", meaning a CS where Close is higher than Open. It should'nt count as well.<<

Use Indicator Compare to Indicator, Close <= Open, with the 3 times within 3 bars Qualifier.

1
Glitch8
 ( 10.62% )
- ago
#3
>>Example, find 3 latest green bars above indicator, not counting Dojis, Hammers, Red bars etc ..<<

There's really no good way to count occurrences and then take an action like this within a BB strategy, but here it is in code:

CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Indicators; using WealthLab.Candlesticks; namespace WealthScript2 { public class MyStrategy : UserStrategyBase { public override void Initialize(BarHistory bars) {          sma20 = SMA.Series(bars.Close, 20);          PlotIndicator(sma20);          cp = CandleGeneDecoder.FindPattern("Neutral Doji"); }              //find third green bar above SMA public override void Execute(BarHistory bars, int idx) {          if (bars.Close[idx] > sma20[idx])          {             //exclude doji             if (CandleGeneDecoder.DetectPattern(bars, idx, cp))                return;             //green bar?             if (bars.Close[idx] > bars.Open[idx])             {                count++;                if (count == 3)                {                   SetBackgroundColor(bars, idx, WLColor.Green.MakeTransparent(32));                }             }          }     else             count = 0; }       //private variables       private int count = 0;       private SMA sma20;       private CandleGenePattern cp; } }
1
Glitch8
 ( 10.62% )
- ago
#4
Candlestick Extension Build 9 is released with the new Condition referred to above.
1
Best Answer
- ago
#5
Thanks, looking great. Looking forward to it :)

I don't have premium yet. Is it the "Candlestick Genetic Evolver" extension that I should purchase?

Thanks in advance
0
Glitch8
 ( 10.62% )
- ago
#6
Yes that’s the one.
1
- ago
#7
Is "ConsecDown" included in Base application or any extension? I can not find it.
I have Powerpacks and Candlesticks only extensions so far.

Cheers
0
Glitch8
 ( 10.62% )
- ago
#8
Yes it’s in the base. Show us a screen shot of where you are looking. It’s in there.
1
- ago
#9
I found it amongst the indicators. I thought it was a Building block. My mistake.
0

Reply

Bookmark

Sort