3D Candlesticks TOPIC

Viewing 15 posts - 46 through 60 (of 62 total)
  • Author
    Posts
  • #116114 quote
    MajorBasse
    Participant
    Average

    Is it possible to display the colours as a line instead to reduce the noise of the candlesticks? I´ve tried to simply change the “DRAWCANDLE” to “DRAWLINE” in the indicators code but it doesn´t seem to work.

    I would like to have a simple line that changes colour like the candles does.

    Thank you.

    #116143 quote
    Nicolas
    Keymaster
    Master

    Where do you want that line to appear? on the price chart or below it?

    #116145 quote
    MajorBasse
    Participant
    Average

    On the price chart

    #116149 quote
    Nicolas
    Keymaster
    Master

    ok so we must anchor that line to something, to follow the price, any idea?

    #116150 quote
    MajorBasse
    Participant
    Average

    What do you mean?  Is it not possible to simply anchor to a standard line chart?

    #116152 quote
    Nicolas
    Keymaster
    Master

    oh I see now what you want. Use this version of the code:

    //05.07.2018
    //ALE@PROREALCODE
    //https://www.automatictrading.it/
    ////////////////////////////////////////////////////////////
    TranslateCandle            =0       //  To maintain both the candles on the graph without overlap
    TransRange                 =0.01    //  To choose distance of the 3D caNdle
    Transparency               =0
    ////////////////////////////////////////////////////////////
    ONCE CandleCci             =1       // CANDLE + COMMODITY CHANNEL INDEX COLOUR
    ONCE CandleRsi             =0       // CANDLE + RSI COLOUR
    ONCE CandleStochastic      =0       // CANDLE + STOCASTIC COLOUR
    ONCE CandleCycle           =0       // CANDLE + CYCLE COLOUR
    ONCE CandleDI              =0       // CANDLE + DIRECTIONAL INDEX COLOUR
     
    //////////////////////////////V//////////////////////////////
    ONCE CciPeriod             =20
    ONCE RsiPeriod             =14
    ONCE N                     =14
    ONCE K                     =3
    ONCE DiPeriod              =14
     
    //////////////////////////////V//////////////////////////////
     
    If CandleCci then                                 // CANDLE + COMMODITY CHANNEL INDEX COLOUR
    MyCci  = Cci[max(1,CciPeriod)](customclose)
    R = (200-MyCci)
    G =(200+MyCci)
    if TranslateCandle then
    DRAWCANDLE(open-(open*TransRange*pointsize), high-(high*TransRange*pointsize), low-(low*TransRange*pointsize), close-(close*TransRange*pointsize)) Coloured (R,G,0,transparency*50)
    else
    DRAWCANDLE(open, high, low, close) Coloured (R,G,0,transparency*50)
    endif
    Elsif CandleRsi then                           // CANDLE + RSI COLOUR
    MyRsi    = RSI[max(1,RsiPeriod)](customclose)
    R =50+(200-(MyRsi-50)*12)
    G =50+(200+(MyRsi-50)*12)
    if TranslateCandle then
    DRAWCANDLE(open-(open*TransRange*pointsize), high-(high*TransRange*pointsize), low-(low*TransRange*pointsize), close-(close*TransRange*pointsize)) Coloured (R,G,0,transparency*50)
    else
    DRAWCANDLE(open, high, low, close) Coloured (R,G,0,transparency*50)
    endif
    Elsif CandleStochastic then                           // CANDLE + STOCHASTIC COLOUR
    MyStoch    = Stochastic[max(1,N),max(1,K)](customclose)
    R =50+(200-(MyStoch-50)*6)
    G =50+(200+(MyStoch-50)*6)
    if TranslateCandle then
    DRAWCANDLE(open-(open*TransRange*pointsize), high-(high*TransRange*pointsize), low-(low*TransRange*pointsize), close-(close*TransRange*pointsize)) Coloured (R,G,0,transparency*50)
    else
    DRAWCANDLE(open, high, low, close) Coloured (R,G,0,transparency*50)
    endif
    Elsif CandleCycle then                           // CANDLE + CYCLE COLOUR
    MyCycle    = Cycle(customclose)
    R = (200-MyCycle*10)
    G =(200+MyCycle*10)
    if TranslateCandle then
    DRAWCANDLE(open-(open*TransRange*pointsize), high-(high*TransRange*pointsize), low-(low*TransRange*pointsize), close-(close*TransRange*pointsize)) Coloured (R,G,0,transparency*50)
    else
    DRAWCANDLE(open, high, low, close) Coloured (R,G,0,transparency*50)
    endif
    Elsif CandleDI then                              // CANDLE + DIRECTIONAL INDEX
    MyDi = DI[max(1,DiPeriod)](customclose)
    R = 50+(200-MyDi*10)
    G =50+(200+MyDi*10)
    if TranslateCandle then
    DRAWCANDLE(open-(open*TransRange*pointsize), high-(high*TransRange*pointsize), low-(low*TransRange*pointsize), close-(close*TransRange*pointsize)) Coloured (R,G,0,(transparency)*50)
    else
    DRAWCANDLE(open, high, low, close)Coloured (R,G,0,transparency*50)
    endif
     
    endif
     
    Return close coloured(r,g,0)

    and set your price setting to a line (otherwise you will still see the normal candlestick of the price chart).

    DAX-1-hour.png DAX-1-hour.png
    #116154 quote
    MajorBasse
    Participant
    Average

    This is exactly what I was looking for, thank you for the quick help Nicolas!

    #118683 quote
    Bard
    Participant
    Master

    Hi there,

    I used a customised RSI Dominant Cycle and standard RSI but although the code looks okay (?), when I launched it on the price chart it now sits just below the current prices/candlesticks?
    So I have two price series candlesticks, one green/white and the other the 3D candles! Any ideas? For those without the code it’s on this forum somewhere but here it is:

    Period = CALL "Ehler's Dominant Cycle Modify" 
    DC = MAX(8, MIN(Round(Period),48) ) 
    myRSI = RSI[DC](close) 
    Return myRSI coloured(0,255,255) as "RSIdc"
    //PeriodDC= 20  //   original by John Ehlers
    PeriodDC= MAX(8, MIN(DC, 48))
     
    IF barindex = 1 THEN
    BP= 0.01
    DC= 20
     
    ELSIF Barindex >= 2 THEN
    REM ---------------------------------------------
    REM Highpass Filter and BP or SuperSmoother Filter together form a Roofing Filter
    REM ---------------------------------------------
    HPPrice= close
    HPPeriod= PeriodDC
    HPBandwidth= 0.3    // 0.7 original Dominant Cycle Measured, 0.3 (0.10-0.50) from Roofing Filter
    HPalpha= (COS(0.25*HPBandwidth*360/HPPeriod) + SIN(0.25*HPBandwidth*360/HPPeriod)-1) / COS(0.25*HPBandwidth*360/HPPeriod)
    HP= (1+HPalpha/2)*(HPPrice-HPPrice[1]) + (1-HPalpha)*HP[1]
     
    BPPrice= HP
    BPPeriod= PeriodDC
    BPBandwidth= HPBandwidth
    beta= COS(360/BPPeriod)
    gamma= 1/COS(360*BPBandwidth/BPPeriod)
    BPalpha= gamma - SQRT(gamma*gamma-1)
    BP= 0.5*(1-BPalpha)*(BPPrice-BPPrice[2]) + beta*(1+BPalpha)*BP[1] - BPalpha*BP[2]
     
    REM ---------------------------------------------
    REM Calculation of Dominant Cycle by counting Zero crossing of BP
    REM ---------------------------------------------
    CountPrice= BP
    DC= DC[1]
    DC= MAX(6, DC)
    counter= counter + 1
    IF CountPrice CROSSES OVER 0 OR CountPrice CROSSES UNDER 0 THEN
    DC= 2*counter
    ThrashH= 1.11   // original 1.25
    IF 2*counter > ThrashH*DC[1] THEN
    DC= ThrashH*DC[1]
    ENDIF
    ThrashL= 0.90   // original 0.8
    IF 2*counter < ThrashL*DC[1] THEN
    DC= ThrashL*DC[1]
    ENDIF
    counter= 0
    ENDIF
     
    ENDIF
     
    DC= MAX(8, MIN(DC, 48))
     
    RETURN DC coloured(0,255,255) as "DomCyclePeriod"
    //, BP coloured(0,255,0,255) as "BandPass"

    Cheers,

    Bard

    Brent-Crude-2-prices-with-3d-candles.png Brent-Crude-2-prices-with-3d-candles.png
    #118706 quote
    Nicolas
    Keymaster
    Master

    All indicators sit below the price chart if you don’t apply them ON THE PRICE CHART 😉

    #118716 quote
    Nicolas
    Keymaster
    Master

    Oh I see now what you mean.. sorry. The candlesticks must have Open/High/Low/Close as reference to perfectly match the ones from the platform. So there must be something that explain this offset in the 3D candlesticks code you are using!

    Bard thanked this post
    #118740 quote
    Bard
    Participant
    Master

    I know I’m a veteran “newbie” coder but even I figured out the 3D needs to be applied to the Price chart! 😀 I commented out the “Dominant Cycle RSI” code just now and left the generic RSI code and it looks great! (pls see screenshot – this image shows the generic RSI working okay)

    Problem is my DC RSI is applied to the Close but still sits below the price series? Can you see anything in my DC RSI code that looks like it could be causing this problem? When I try Settings: Apply to Low or any other combination like (H+L+C)/3 the extra price series of candles doesn’t respond and stays in exactly the same position?

    Cheers Nicolas.

    1.png 1.png
    #118853 quote
    Bard
    Participant
    Master

    If I need to reference the O/C/H/L when I’m using myRSI = RSI [DC] (close) and HPPrice= close which also refernces the closing price (from Ehler’s Dominant Cycle indicator), I’m still not sure how to go about this to get it to work? I mean, “close” is already referenced, so what’s the problem?

    Elsif CandleDCRsi then                      // CANDLE + DC RSI COLOUR
    MyDCRsi = CALL "RSI - Dominant Cycle"
    DCRsi = MyDCRsi[max(1,PeriodDC)]
    HPPrice= close
    HPPeriod= PeriodDC
    #119633 quote
    Bard
    Participant
    Master

    This setting fixes overlapping On Price candles: TransRange =0.0001 (instead of default setting = 0.01)

    Hi @Nicolas, can you figure out why this warning comes up (pls see screnshot) when I add an implied volatility indicator to the 3D, code even though I have added the parameters [22,60] into that 3D candle code?

    MyIVStoch = CALL "Implied Volatility Stochastic"
    
    MyIVStoch = CALL "Implied Volatility Stochastic"[22,60]
    IVStoch   = MyIVStoch  // Two external vars [22,60], Short IV + Long IV Period
    R =50+(200-(IVStoch-50)*6) 
    etc etc...

    Much appreciated,

    Cheers Bard

    warning.png warning.png
    #119636 quote
    Vonasi
    Moderator
    Master

    Why are you calling it twice? Once with no parameters which would give an error and then with the correct parameters. Delete line 1.

    #119693 quote
    Bard
    Participant
    Master

    Thanks Vonasi, Line 1 was actually buried far higher up in my indicator code but I should have spotted this in my posting above. Line 1 has been removed.

    Now my indicator “Implied Volatility Stochastic” actually in fact has 7 values returned (at the end of it’s code) but I only made two of them actual variables, [22, 60]. However now the warning is now telling me that the “Implied Volatility Stochastic” returns 7 values but your code needs 1.

    One? Shouldn’t it be two, as in [22, 60]?

    And if it is one value which do I use, 22 or 60?

    Cheers.

Viewing 15 posts - 46 through 60 (of 62 total)
  • You must be logged in to reply to this topic.

3D Candlesticks TOPIC


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
ALE @aleale Moderator
Summary

This topic contains 61 replies,
has 10 voices, and was last updated by Bard
6 years, 1 month ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/08/2018
Status: Active
Attachments: 20 files
Logo Logo
Loading...