Big Body Candle

Viewing 15 posts - 1 through 15 (of 27 total)
  • Author
    Posts
  • #140351 quote
    parthapersonal
    Participant
    Average

    Hi,

    I am trying to identify the big body candle out of last 12 candles, but the code is returning “nil or none”. Any help would be much appreciated.

    Regards,

    DEFPARAM CalculateOnLastBars = 1000
    Bullish = close > open
    Bearish = close < open
    BigBody = HIGHEST[p](abs(close-open))
    //BearishBigBody = HIGHEST[p]((open-close))
    //
    // UP trend detection
    //Count1 = 0 i      = 0 WHILE Count1 <= p AND i < BarIndex i = i + 1 IF Count1 = 0 THEN IF Bullish[i] THEN Count1 = 1 MyHigh = BullishBigBody[i] ENDIF ENDIF WEND 
    d1=Bullish
    d2=BigBody
    UCond= d1 and d2
    d3=Bearish
    DCond= d2 and d3
    cond=0
    if Ucond then
    cond=1
    elsif Dcond then
    cond=-1
    endif
    return cond as "BigBody"
    #140352 quote
    parthapersonal
    Participant
    Average

    “p” is a variable having value as 12

    #140357 quote
    robertogozzi
    Moderator
    Master

    Try replacing line 4 with:

    BigBody = abs(close - open) = HIGHEST[p](abs(close-open))
    #140367 quote
    parthapersonal
    Participant
    Average

    Many thanks Robert. It worked. Appreciate your fast and reliable response. Just a question, why there are 2 “=” signs in

    BigBody = abs(close open) = HIGHEST[p](abs(closeopen))

    #140375 quote
    robertogozzi
    Moderator
    Master

    Because it first checks that the body is the highest one within the last p bars:

    abs(close – open) = HIGHEST[p](abs(close–open))

    then the boolean value returned (true or false) is assigned to variable BigBody.

    #140472 quote
    parthapersonal
    Participant
    Average

    Many thanks Robert. However, when I created the boundary (Upper Line and Lower Line) of the BigBody and then tried to identify the Bounce from those lines based on the conditions as per enclosed PRT, it is missing the correct signals and generating false or Late signals somewhere else as shown in the enclosed chart. Can you please enlighten what is wrong here.

    Regards,

    DEFPARAM CalculateOnLastBars = 1000
    Bullish = close > open
    Bearish = close < open
    BigBody = abs(close - open) = HIGHEST[p](abs(close-open))
    
    d1=Bullish
    d2=BigBody
    UCond= d1 and d2
    d3=Bearish
    DCond= d2 and d3
    
    if Ucond then
    cond=1
    elsif Dcond then
    cond=-1
    endif
    //
    // Creating high and low lines for the "BIGBODY"
    if cond=1 then
    highline=high
    lowline=low
    elsif cond=-1 then
    highline=high
    lowline=low
    endif
    
    //Heikin-ashi
    if barindex>1 then
    hc=(open+close+low+high)/4
    ho=(ho[1]+hc[1])/2
    xHigh = Max(hO, hC)
    xLow = Min(hO, hC)
    hh = Max(High,xHigh)
    hl = Min(Low,xLow)
    endif
    //
    // BOUNCE Identification
    IF cond=-1 AND HH[1]>highline[1] AND HC<highline THEN
    OBS=-64
    ELSIF cond=-1 AND HH>highline AND HC<highline THEN
    OBS=-64
    ELSIF cond=1 AND HL[1]<lowline[1] AND HC>lowline THEN
    OBS=64
    ELSIF cond=1 AND HL<lowline AND HC>lowline THEN
    OBS=64
    ELSE
    OBS=0
    ENDIF
    
    return OBS as "BigBody-Line-Bounce"
    
    Late-Wrong-Signals.jpg Late-Wrong-Signals.jpg
    #140477 quote
    robertogozzi
    Moderator
    Master

    What value is P?

    What date & time are those candlesticks?

    #140525 quote
    parthapersonal
    Participant
    Average

    Sorry Robert, P is 15 and chart is of 5 min for GBPUSD as shown in the chart. Your help would be much appreciated.

    Regards,

    #140527 quote
    parthapersonal
    Participant
    Average

    Date was 30.07.2020

    #140555 quote
    robertogozzi
    Moderator
    Master

    What TZ is it, compared tu UTC ?

    #140598 quote
    parthapersonal
    Participant
    Average

    Hello Robert,

    Thank you for your response, however there is no “TZ” or “UTC” in the code. Where did you find them? I am again pasting the code for your reference.

    Regard

    DEFPARAM CalculateOnLastBars = 1000
    Bullish = close > open
    Bearish = close < open
    BigBody = abs(close - open) = HIGHEST[p](abs(close-open))
    
    d1=Bullish
    d2=BigBody
    UCond= d1 and d2
    d3=Bearish
    DCond= d2 and d3
    
    if Ucond then
    cond=1
    elsif Dcond then
    cond=-1
    endif
    //
    // Creating high and low lines for the "BIGBODY"
    if cond=1 then
    highline=high
    lowline=low
    elsif cond=-1 then
    highline=high
    lowline=low
    endif
    
    //Heikin-ashi
    if barindex>1 then
    hc=(open+close+low+high)/4
    ho=(ho[1]+hc[1])/2
    xHigh = Max(hO, hC)
    xLow = Min(hO, hC)
    hh = Max(High,xHigh)
    hl = Min(Low,xLow)
    endif
    //
    // BOUNCE Identification
    IF cond=-1 AND HH[1]>highline[1] AND HC<highline THEN
    OBS=-64
    ELSIF cond=-1 AND HH>highline AND HC<highline THEN
    OBS=-64
    ELSIF cond=1 AND HL[1]<lowline[1] AND HC>lowline THEN
    OBS=64
    ELSIF cond=1 AND HL<lowline AND HC>lowline THEN
    OBS=64
    ELSE
    OBS=0
    ENDIF
    
    return OBS as "BigBody-Line-Bounce"
    
    #140615 quote
    robertogozzi
    Moderator
    Master

    It’s your TZ.

    Mine is UTC + 1 DST (currently Utc+2), so when I see a candle in your pic at 11am, what 11am is it? it is UTC+???

    Moreover, are you with IG?

    #140642 quote
    parthapersonal
    Participant
    Average

    Sorry Robert, I thought you are asking about TZ and UTC as variable in the code.

    Our time zone (TZ) is UTC+ 10

    Yes, we are using PRT (v10.3 – 1.8.0-_202) from IG

    #140737 quote
    robertogozzi
    Moderator
    Master

    I can’t see anything wrong with those candlesticks. If you think some of them are wrong (late or missing), please let me know, for each candle (use their time tag):

    • the value of that candle
    • the highest value calculated to compare them.

    Moreover:

    • you are mixing some computations on HA candles  (lines 38-44) and regular japanese candles (the rest of the code)
    • lines 19-25 show two dfferent conditions, but the value you assign to variables is the same for both.

    If you explain the details of waht you want to achieve I might be able to help you better.

    #140859 quote
    parthapersonal
    Participant
    Average

    Hello Robert, thank you for your response. Appreciate. I am trying to do the following steps:

    1. Identify Big body bar

    2. Identify the high and low of the Big body bar to draw horizontal high line (HL) and low line (LL) on its high and low

    3. Identify whether the Big body bar is bullish or bearish

    4. Identify bounce Short opportunity: If bearish big body (B) and any heikin ashi bar (A)’s high, after the bearish big body (B), is higher than the high line (HL) (red line) and heikin ashi close (HC) of the same bar (A) is lower than high line (HL) then print OBS as -64

    5. Identify bounce Long opportunity: If bullish big body (BB) and any heikin ashi bar (AA)’s low, after the BB, is lower than the low line (LL) and heikin ashi close (HC) of the same bar (AA) is higher than low line (LL) then print OBS as 64

    Trust this help.

    The missed signal’s time stamps are as below:

    Symbol: GBPUSD mini

    Date: 30.07.2020

    Time: 11:05, 12:50, 13:55, 14:40, 15:40

    Regards,

    Missing-signals-1.jpg Missing-signals-1.jpg
Viewing 15 posts - 1 through 15 (of 27 total)
  • You must be logged in to reply to this topic.

Big Body Candle


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

This topic contains 26 replies,
has 2 voices, and was last updated by parthapersonal
5 years, 5 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/29/2020
Status: Active
Attachments: 5 files
Logo Logo
Loading...