5 out of 7 red candles coding question

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #25925 quote
    ck1066
    Participant
    Average

    Hi,

    How do I test whether, as an example, 5 out of the last 7 candles were red (in a downtrend) . Any green candles can be ignored unless they break the previous high.

    Opposite for uptrend.

    #25970 quote
    Wing
    Participant
    Veteran

    In a downtrend, something like this:

     

    
    FiveSevenRed=0
    RedCandles=0
    
    FOR i = 0 TO 6 DO
               IF (Close[i] < Open[i]) THEN
                     RedCandles=RedCandles+1
               ELSE if close>high[i+1] then
                     Break
               ENDIF
               FiveSevenRed=1
    NEXT
    
    If RedCandles<5 then
    FiveSevenRed=0
    Endif
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

5 out of 7 red candles coding question


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ck1066 @ck1066 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Wing
8 years, 11 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 02/21/2017
Status: Active
Attachments: No files
Logo Logo
Loading...