Green candle cross 50 and 20 MA


Category:
0
0

Hello Pete,

Thank you very much for your assistance in advance.

I would like to add a study to a scan. The code of the should reflect when a green candle crosses the 50 and 20 EMA averages at the same time. The crossing will be valid for any price along the candle (it can cross at high, or low, or close…or the body).

Marked as spam
Posted by (Questions: 6, Answers: 8)
Asked on January 30, 2018 4:57 pm
272 views
0

Ok, just need to clarify something first. So it does not matter what the price action pattern looks like before the cross. You only care that we find stocks where a single green candle has crossed both ema’s at the same time. And you don’t care which of the two ema’s are on top. Yes?
Also, you don’t care if the previous bar was already above both the ema’s. You will accept a pattern where the open of the next bar gaps down and opens below the two ema’s, then closes above them. Yes? There are many other variations I could list here. In practice, I find it very rare for the strict interpretation of such a vague price pattern to be acceptable to the person requesting it. So think on this a while and get back to me.

( at January 30, 2018 5:17 pm)
0

Thank you Pete for the suggestions. In my scan I have already created studies that verifies the conditions of MA 200 and MA 50 are increasing. In addition to other conditions like SAR and Heiken Ashi. I just want to add the study I requested from you to my scan then check the results.
Thank you,

( at January 31, 2018 10:37 am)
0
Private answer

Ok, thanks for clarifying. Here is the code required to capture that green candle crossing the two ema’s at the same time:

def ema20 = ExpAverage(close, 20);
def ema50 = ExpAverage(close, 50);
def greenCandle = close > open;
def greenCandleCrossingBoth = greenCandle and low < ema20 and low < ema50 and high > ema20 and high > ema50;
plot scan = greenCandleCrossingBoth;

This requires the full candle including the high and low wick to be spread across both ema’s at the same time. I haven’t tested this, let me know if you find any errors.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on January 31, 2018 12:31 pm
0

Thank you Pete it worked without errors.

( at February 12, 2018 7:15 am)
0

Hi Pete,
As previously stated the scan did not give any errors, but now when I tried few scans it does not give me what I want. It was my fault when I said “Crosses the 50 and 20 EMA”, actually I wanted to say when the price (any part of the price) crosses EMA20 or EMA50 (or even EMA200 if you can add it please). Sorry for misspoke

( at February 19, 2018 6:40 pm)
0

I suggest you post this one as a new question. Since your new specifications don’t really match the question of this title. And this time I will recommend you provide 1 or more screenshots with your question. Full chart screenshots so we get all the details. And mark on those charts each of the signals you are trying to capture.

( at February 19, 2018 7:07 pm)