Ok, so we’ll draw up some code that checks if only the wick of a candle has crossed the 8 ema. This will be accomplished by checking if the high is above the 8 ema, while the close and open are below it. For the other side we’ll be checking if the low is below the 8 ema, while the close and open are above it. This means the pattern is only complete once the bar has completely closed and the new bar has opened. So we’ll need to craft the signals to trigger on the open of the bar that follows this pattern. (that means the audible alerts will not sound until the bar that pierces the 8 ema has closed and the next bar has opened)
Here is the code. Screenshot attached. I have placed the crosshairs purposefully to demonstrate the extreme fringe of the signals. The displayed value of the 8 ema is rounded. So this looks like the open and the 8 ema are equal. However the 8 ema is actually below the open. Which means that is a valid signal given the specifications you listed.
def ema = ExpAverage(close, 8);
def piercingHigh = high > ema and open < ema and close < ema;
def piercingLow = low < ema and open > ema and close > ema;
plot signalHigh = piercingHigh[0];
signalHigh.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_DOWN);
signalHigh.SetDefaultColor(Color.MAGENTA);
plot signalLow = piercingLow[0];
signalLow.SetPaintingStrategy(PaintingStrategy.BOOLEAN_ARROW_UP);
signalLow.SetDefaultColor(Color.CYAN);
Alert(signalHigh[1], "Piercing High", Alert.BAR, Sound.RING);
Alert(signalLow[1], "Piercing Low", Alert.BAR, Sound.RING);
I will refer back to my original comments about there being several other factors involved in order to achieve your desired results. I anticipated this very thing from the start. And having done so, I can also assure you that candle stick patterns will not get you there either. Something else will be identified, and something else after that. So if you want to pursue this further we can open up a custom thinkscript project. I can build each phase as you identify more conditions and filters to add. And I can bill you for each phase along the way until you achieve the desired result. Here is where you can get started: https://www.hahn-tech.com/about/
Okay sounds good.