Count 5-10candle sticks that closes above 50 ema

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #99253 quote
    Jehsgo
    Participant
    New

    Hi,

     

    I want to count how many candles (before a bearish engulfing candle) that closes above the exponential moving average. I just cant figure out how to code it. I tried For-do-next and failed. can anyone help me with this?

    #99256 quote
    robertogozzi
    Moderator
    Master

    There you go:

    Bullish   = close > open
    Bearish   = close < open
    Opposite  = (Bearish AND Bullish[1]) OR (Bearish[1] AND Bullish)
    Body      = abs(close - open)
    Engulfing = (Body > Body[1]) AND Opposite
    BearishEng= Engulfing AND Bearish AND (Open >= close[1]) AND (close <= open[1])
    MyEma     = average[50,1](close)
    BarCount  = 0
    If BearishEng THEN
       FOR i = BarIndex - 1 DOWNTO 1
          x = BarIndex - i
          IF close[x] > MyEma[x] THEN
             BarCount = BarCount + 1
          ELSE
             BREAK
          ENDIF
       NEXT
    ENDIF
    RETURN BarCount
    #99289 quote
    robertogozzi
    Moderator
    Master

    I just edited line 6.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Count 5-10candle sticks that closes above 50 ema


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Jehsgo @jehson_go Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by robertogozzi
6 years, 9 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 05/23/2019
Status: Active
Attachments: No files
Logo Logo
Loading...