Combining two scripts, wide range bar and candlestick pattern

Hi Optuma

I have two scripts that work well individually but I am trying to combine the two into one showview or showbar script. Basically I would like to find a particular candle closing below its highs and occurring within the last 10 days. I then want to find the last candle, which must close at its highs and be the first candle to close at its highs in the last 20 days and be the widest range candle in last 7 days (ie a wide range bullish marubozu candle).

Here’s the script I have so far, but it does not show any results when I put it into showview, so clearly I am doing something wrong. As always any assistance would be very helpful, thank you.

//First signal - Candle type occurring within last 10 days;
V5 = BARTYPES(DEFAULT=CloseBelowMid) and BARTYPES(DEFAULT=CloseAboveOpen) and MA(BARS=8, STYLE=Exponential) > MA(BARS=15, STYLE=Exponential) and TIMESINCESIGNAL()<10;
//2nd Signal - Candle close at high last bar;
V4 = CandlestickPattern(SCANTYPE=[Bullish White Marubozu,Bullish Closing White Marubozu,Bullish Opening White Marubozu]) Matches;
//Widest bar in last 7 days;
V1 = HIGH() - LOW() ;
V2 = HIGHESTHIGH(V1, BARS=7, INCBAR=True);
V3 = V1 == V2;

V3 and V4 and V5;
//Marubozu first occurence in last 20 days;
NOREPEAT(V4, BARS=20);

Hi Tonia,

I think it’s because you have conflicting conditions: closing below the midpoint but with a bullish marubozu candle patterns, which is a close at the high. As this couldn’t happen on the same day there are no results, so you will have to refine the signal.

Also, for TIMESINCESIGNAL() functions the signal has to be defined within the brackets, otherwise there’s nothing to count.

You would need to do something like this to do a timecount of V5 in a new variable V6:

V5 = BARTYPES(DEFAULT=CloseBelowMid) and BARTYPES(DEFAULT=CloseAboveOpen) and MA(BARS=8, STYLE=Exponential) > MA(BARS=15, STYLE=Exponential);
V6 = TIMESINCESIGNAL(V5)<10;

Always learn something from you, Darren, thank you kindly.