Basing candle indicator

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #44298 quote
    paddan
    Participant
    New

    Hi, I would like to get my hands on a indicator which display candles with 50% or lower bodys. Does anyone know or would like to help me build one?

    Thank you for reply!

    Best!

    #44308 quote
    robertogozzi
    Moderator
    Master

    This piece of code does what you want, displaying a green dot below each candle that meets your requirements:

    DEFPARAM CalculateOnLastBars = 500  //just to speed up things
    R=0
    G=255
    B=0
    F=255
    IF close > open THEN
       UpperShadow = high - close
       LowerShadow = open - low
    ELSE
       UpperShadow = high - open
       LowerShadow = close - low
    ENDIF
    Shadows = UpperShadow  + LowerShadow
    Body = range - Shadows
    IF Body <= (Shadows / 2) THEN
       DotVal = low - (3 / pipsize)
       DRAWTEXT("•",barindex,dotval,Dialog,Bold,12) coloured(R,G,B,F)
    ENDIF
    RETURN
    
    #44310 quote
    paddan
    Participant
    New

    Sorry but nothing happens, I can load it but no dots. :/

    #44313 quote
    robertogozzi
    Moderator
    Master

    You should add it to the price, not below.

    As shown in the pic:

    • 1 – click on the PRICE WRENCH in the upper left corner
    • 2 – with your cursor on the tag PRICE click on “add indicator”
    • 3 – tht’s the outcome

    I changed the code to modify display, as follows:

    DEFPARAM CalculateOnLastBars = 1000
    R=0
    G=255
    B=0
    F=255
    IF close > open THEN
       UpperShadow = high - close
       LowerShadow = open - low
    ELSE
       UpperShadow = high - open
       LowerShadow = close - low
    ENDIF
    Shadows = UpperShadow  + LowerShadow
    Body = range - Shadows
    IF Body <= (Shadows / 2) THEN
       DotVal = low - (100 * pipsize)
       DRAWTEXT("•",barindex,DotVal,Dialog,Bold,12) coloured(R,G,B,F)
    ENDIF
    RETURN

    I attach the code so that you can import it, if you don’t want to copy and paste it.

    paddan thanked this post
    #44320 quote
    paddan
    Participant
    New

    Oh I see! Thank you very much! You are a very kind person!

    robertogozzi thanked this post
    #44322 quote
    paddan
    Participant
    New

    Sorry, but it seems that that the dots does not work properly, see attache picture. some candles tdont get the dots even if its a 50% candle. It seems that the higher timeframe, it miss more.

    #44328 quote
    robertogozzi
    Moderator
    Master

    My pic was on GbpJpy monthly chart and it works, I also tried it on DAX both 1 hr and monthly and it displays correctly all candles whose body is less than 50%  of their range.

    You may try to modify this part of line 16:

    (100 * pipsize)

    replacing 100 with 10. This should not affect computations but only the place where dots are displayed.

    #44334 quote
    paddan
    Participant
    New

    This pic is from DAX weekly, do you get different than mine?

    #44348 quote
    robertogozzi
    Moderator
    Master

    Indeed it’s somewhat odd!

    I wrote this strategy (on DAX weekly chart) to debug the values of variables:

    DEFPARAM CumulateOrders = false
    
    IF close > open THEN
       UpperShadow = high - close
       LowerShadow = open - low
    ELSE
       UpperShadow = high - open
       LowerShadow = close - low
    ENDIF
    Shadows = UpperShadow  + LowerShadow
    Body = range - Shadows
    //IF Body <= (Range / 2) THEN
    //DotVal = low - (20 * pipsize)
    //ENDIF
    IF close < 0 THEN  //useless, it is compulsory to have at least one BUY
       BUY AT MARKET
    ENDIF
    GRAPH UpperShadow           AS "uSH"
    GRAPH LowerShadow           AS "lSH"
    GRAPH Shadows               AS "Shs"
    GRAPH Body                  AS "Bdy"
    //GRAPH Body <= (Shadows / 2) AS "%"
    //GRAPH DotVal                AS "Dot"
    GRAPH Range                 AS "rng"
    

    the attached pic shows that variable “rng” (range) retains a value of 277.5, while the ProOrder box on the chart says the distance High-Low is 280.2!

    I don’t know why, I hope someone can help spot the bug!

    #45308 quote
    AVT
    Participant
    Senior

    We had an issue with the weekly drawing position being – if I recall correctly – 1 candle too much right-sided (although calculation values are correct)

    #78585 quote
    Firoj Gaiban
    Participant
    New

    robertogozzi

    sir need Basing Candle Indicator for mt4 please code for it

    in above post Dot shows for Basing candle , sir i need blue colur for basing candle instead of Dot …

    plz check attachment ….like this i need

    #78591 quote
    robertogozzi
    Moderator
    Master

    robertogozzi

    sir need Basing Candle Indicator for mt4 please code for it

    in above post Dot shows for Basing candle , sir i need blue colur for basing candle instead of Dot …

    plz check attachment ….like this i need

    Please update your country flag! Thank you.

    Only conversions TO ProRealTime are possible, as from this link https://www.prorealcode.com/topic/free-conversion-mt4-indicators-mql4/.

    If you meant to change my code so that it mirrors your screenshot, there you go:

    DEFPARAM CalculateOnLastBars = 1000
    UpperShadow = high - max(close,open)
    LowerShadow = min(close,open) - low
    Shadows     = UpperShadow  + LowerShadow
    Body        = range - Shadows
    IF Body <= (Shadows / 2) THEN
       DRAWCANDLE(open,high,low,close) COLOURED(255,215,0,255) BORDERCOLOR(255,0,255,255)
    ENDIF
    RETURN

    You can choose different colours https://www.prorealcode.com/wp-content/uploads/2015/09/P1jHlnG.jpg.

    Nicolas thanked this post
    #78994 quote
    Firoj Gaiban
    Participant
    New

    Robbert

    sir how to make it indicator for mt4 , i don’t know how can , please make it for me and send to my mail   [deleted]

    thanks…..

    #79002 quote
    Vonasi
    Moderator
    Master

    Robbert

    sir how to make it indicator for mt4 , i don’t know how can , please make it for me and send to my mail

    thanks…..

    You need to go to an MT4 forum site and ask someone there to convert it.

    This is a Pro Real Time forum where you can get code converted from MT4 to PRT but not the other way around.

    You have repeatedly asked for the same thing which is making us despair a little. Please stop asking.

    Also it is not wise to post email addresses on forums so I have deleted it for you.

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

Basing candle indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
paddan @paddan Participant
Summary

This topic contains 13 replies,
has 5 voices, and was last updated by Vonasi
7 years, 5 months ago.

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