Double candlesticks?

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #55216 quote
    Marcel van VlietMarcel van Vliet
    Participant
    Veteran

    Hi, When I apply my Bias Determinator indicator on two EMA’s instead of one, somtimes a double candlestick appears on the chart (See ellipses). Anyone @Nicolas an idea how to solve this?

    //Bias Determinator
    //09/12/2017
    //Marcel van Vliet
    
    //--- parameters
    // EMAperiod=34
    // mmTYPE=1 (mm type)
    // ---
    
    EMAh = exponentialaverage[34](close)
    EMAl = exponentialaverage[55](close)
    
    bodyhigh = max(open,close)
    bodylow = min(open,close)
    
    if(open<=close and close > EMAH) then
    LongWickUp = high
    LongCandleUp = bodyHigh
    LongWickDown = low
    LongCandleDown = bodyLow
    elsif(open>=close and close > EMAH) then
    LongWickUp = low
    LongCandleUp = bodyLow
    LongWickDown = high
    LongCandleDown = bodyHigh
    elsif(open<=close and close < EMAL) then
    ShortWickUp = high
    ShortCandleUp = bodyHigh
    ShortWickDown = low
    ShortCandleDown = bodyLow
    elsif(open>=close and close < EMAL) then
    ShortWickUp = high
    ShortCandleUp = bodyHigh
    ShortWickDown = low
    ShortCandleDown = bodyLow
    elsif(open<=close and close < EMAH and close > EMAL) then
    RangeWickUp = high
    RangeCandleUp = bodyHigh
    RangeWickDown = low
    RangeCandleDown = bodyLow
    elsif(open>=close and close < EMAH and close > EMAL) then
    RangeWickUp = low
    RangeCandleUp = bodyLow
    RangeWickDown = high
    RangeCandleDown = bodyHigh
    endif
    
    //bullish candlesticks
    if close>EMAH then
    DRAWCANDLE(LongCandleDown,LongWickUp,LongWickDown,LongCandleUp) coloured(0,0,102)
    endif
    
    //Neutral candlesticks above the MA
    If close>EMAH and close<open then
    DRAWCANDLE(LongCandleDown,LongWickUp,LongWickDown,LongCandleUp) coloured(150,150,150)
    Endif
    
    //bearish candlesticks
    if close<EMAL then
    DRAWCANDLE(ShortCandleDown,ShortWickUp,ShortWickDown,ShortCandleUp) coloured(204,0,0)
    endif
    
    //Neutral candlesticks under the MA
    If close<EMAL and close>open then
    DRAWCANDLE(ShortCandleDown,ShortWickUp,ShortWickDown,ShortCandleUp) coloured(150,150,150)
    Endif
    
    //neutral candlesticks (range)
    if close<EMAH and close>EMAL then
    DRAWCANDLE(RangeCandleDown,RangeWickUp,RangeWickDown,RangeCandleUp) coloured(150,150,150)
    endif
    
    RETURN EMAH coloured(204,204,204) style(line) as "high EMA", EMAL coloured(102,102,102) style(line) as "low EMA"
    

     

    Dubbele-candles.jpg Dubbele-candles.jpg
    #55470 quote
    NicolasNicolas
    Keymaster
    Legend

    I think it is because you try to draw multiple times a candlestick with different conditions that could be tested true and at the same time. 

    Marcel van Vliet thanked this post
Viewing 2 posts - 1 through 2 (of 2 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

Double candlesticks?


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 12/09/2017
Status: Active
Attachments: 1 files
ProRealCode ProRealCode
Loading...