Jump to content
Medved Trader Forums

Scan to detect candle pullback to near ema


Recommended Posts

Any help with constructing this scan would be appreciated. I want to detect a candle close that approaches to within a specified % of the 190-length ema (eg candle crossing below EMA+0.02*EMA). EMA should be in a general long-term uptrend (not necessarily monotonic). Candles should be in short-term downtrend.

Link to comment
Share on other sites

Define "long-term uptrend (not necessarily monotonic)" algorithmically. Maybe "in the last 30 candles, at least in 20 of them the EMA went up"?

Same with "short-term downtrend" for candles? - "In the last 6 candles, at least 5 were up, and the last one was up"?

You will find that once you define these things for yourself, writing the scan becomes a lot simpler.

Link to comment
Share on other sites

7 hours ago, Mike Medved said:

Define "long-term uptrend (not necessarily monotonic)" algorithmically. Maybe "in the last 30 candles, at least in 20 of them the EMA went up"?

Same with "short-term downtrend" for candles? - "In the last 6 candles, at least 5 were up, and the last one was up"?

You will find that once you define these things for yourself, writing the scan becomes a lot simpler.

Ok, this was easier than I thought..

code1.thumb.png.207453fafc3085279664e0cb6059eacd.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...