Arg Posted July 12, 2023 Report Share Posted July 12, 2023 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. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 12, 2023 Report Share Posted July 12, 2023 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. Quote Link to comment Share on other sites More sharing options...
Arg Posted July 13, 2023 Author Report Share Posted July 13, 2023 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.. Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted July 14, 2023 Report Share Posted July 14, 2023 That would work. If you encounter serious slowdowns, the Count functions could be replaced with manually counting using two StateFIFOQueues. Instead of looping (which is what Count does). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.