Candles in a row

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #48267 quote
    TraderArun
    Participant
    Junior

    Hi,

    Could someome provide me with code that I can use in the ProScreener?

    I would like the screener to find all stocks that have between 5 to 10 green candles in a row

    Thanks

    #48285 quote
    Nicolas
    Keymaster
    Legend

    Topic moved to ProScreener forum section.

    This code should do the trick:

    count = 0
    for i = 0 to 9 do 
     if close[i]>open[i] then 
      count=count+1
     endif
     if close[i]<open[i] then 
      count=0
      break
     endif
    next
    
    test = count>=5
    
    screener[test] (count as "green candles")
    #48289 quote
    robertogozzi
    Moderator
    Legend
    IF summation[5](close > open) = 5 THEN ...

    Of course you might want to change the value 5 with one that best suits you.

    Also, you my assign the result to a variable.

    Should you need to check that the green candles need not be consecutive, i.e. 6 out of the last ten:

    IF summation[10](close > open) = 6 THEN ...

    To adapt it to red candles you just need to replace “close >  open” with “open > close”.

    Roberto

    Nicolas thanked this post
    #53884 quote
    Nobody
    Participant
    Veteran

    this my version , first we need the consecutive green counter      

    Increase = (Close > Close[1])
    Count = 0
    WHILE Increase[Count] DO
    Count = Count + 1
    WEND
    RETURN Count

    then we need the screener 

    //5 t0 10 green candles
    
    
    
    indicator1 = CALL "CC UP"
    c1 = (indicator1 >= 5)
    
    indicator2 = CALL "CC UP"
    c2 = (indicator2 <= 10)
    
    criteria = CALL "CC UP"
    
    SCREENER[c1 AND c2] (criteria AS "CC UP")
    

    you could make the cl and c2 inputs variables to make scan more versatile as well 

    //5 t0 10 green candles variable
    
    a = 5
    
    b = 10
    
    
    indicator1 = CALL "CC UP"
    c1 = (indicator1 >= a)
    
    indicator2 = CALL "CC UP"
    c2 = (indicator2 <= b)
    
    criteria = CALL "CC UP"
    
    SCREENER[c1 AND c2] (criteria AS "CC UP")

     

    #53885 quote
    Nobody
    Participant
    Veteran

    TO go a step further you could scan for ‘x’ greencandles lookbacking back 1 and no green candles current bar to find potential reversals  

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

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Candles in a row


ProScreener: Market Scanners & Detection

New Reply
Author
author-avatar
TraderArun @traderarun Participant
Summary

This topic contains 4 replies,
has 4 voices, and was last updated by Nobody
8 years, 9 months ago.

Topic Details
Forum: ProScreener: Market Scanners & Detection
Language: English
Started: 10/05/2017
Status: Active
Attachments: No files
Logo Logo
Loading...