Wicks

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #147852 quote
    umebon
    Participant
    Average

    Hi

    How do I write the code if I want too identify wicks on previous Heiken-Ashi candle? I want too be able too identify if previous  red Heiken has no wick on the upper side and if previous green Heiken has no wick on the lower side.

    #147855 quote
    robertogozzi
    Moderator
    Master

    There you go (not tested):

    once xOpen = open
    xClose     = (open + close + high + low) / 4
    if barindex > 0 then
        xOpen  = (xOpen + xClose[1]) / 2
    endif
    xLow       = min(low,min(xClose,xOpen))
    xHigh      = max(high,max(xClose,xOpen))
    //xTypic   = (xHigh + xLow + xClose) / 3
    //xMed     = (xHigh + xLow) / 2
    //xRange   = xHigh - xLow
    Bullish    = xClose > xOpen
    Bearish    = xClose < xOpen
    Red        = Bearish AND (xOpen = xHigh)
    Green      = Bullish AND (xOpen = xLow)

    RED is the current candle, RED[1] is the previous one, RED[2] is the second previous one, and so on….

    The same is true for GRREN candles.

    umebon thanked this post
    #147857 quote
    umebon
    Participant
    Average

    Thanks, where do I put the [1] too get the previous Heikin?

    #147858 quote
    robertogozzi
    Moderator
    Master

    The way I did.

    umebon thanked this post
    #147861 quote
    umebon
    Participant
    Average

    Im totally off.. how does the code look with the previous candle?

    #147868 quote
    robertogozzi
    Moderator
    Master

    As I said, RED is the current candle, RED[1] is the previous one, RED[2] is the second previous one, and so on….

    You need to watch some videos about programming at https://www.prorealcode.com/programming-with-prorealtime/, or at https://www.prorealtime.com/en/videos_tutorial-trading and on the ProRealTime’s YouTube channel.

    Moreover, reading documentation at https://trading.prorealtime.com/en/programming-help and some of the thousands of code examples in this forum may further help.

    We cannot take a complete course post after post!

    umebon thanked this post
    #147871 quote
    umebon
    Participant
    Average

    Tnx, I can agree that i must learn more. But anyway, thanks for the support.

    #147875 quote
    Luciole
    Participant
    Senior

    You have everything in Roberto’s code.

    Here a version that you can put under your chart with “barchart” for green and red parameters  OR on your graphs with arrows for No-Wicks candles.

     

    once xOpen = open
    xClose     = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen  = (xOpen + xClose[1]) / 2
    endif
    xLow       = min(low,min(xClose,xOpen))
    xHigh      = max(high,max(xClose,xOpen))
    //xTypic   = (xHigh + xLow + xClose) / 3
    //xMed     = (xHigh + xLow) / 2
    //xRange   = xHigh - xLow
    Bullish    = xClose > xOpen
    Bearish    = xClose < xOpen
    Red        = Bearish AND (xOpen = xHigh)
    Green      = Bullish AND (xOpen = xLow)
    
    if Green then
    drawarrowup(barindex,lowest[3](low)) coloured(0,255,51)
    endif
    
    if Red then
    drawarrowdown(barindex,highest[3](high)) coloured(102,102,102)
    endif
    
    return red as "red" , green as "green"
    robertogozzi thanked this post
    #222153 quote
    amitoverseas40
    Participant
    Junior

    You have everything in Roberto’s code.

    Here a version that you can put under your chart with “barchart” for green and red parameters OR on your graphs with arrows for No-Wicks candles.

    Hi Roberto, Luciole – I have tried to programme on arrow, alert when RED crosses over Green and vice versa i.e. when open trying to go over last bar with no wicks and vice versa for down, but not working as I might need to loop, also to calculate points /pips from last arrow/alert on either side, which I am not able to do, please can you help?

    //minCandles = 1
    //
    once xOpen = open
    xClose = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen = (xOpen + xClose[1]) / 2
    trigger=xOpen
    endif
    xLow = min(low,min(xClose,xOpen))
    xHigh = max(high,max(xClose,xOpen))
    xpip=xHigh-xLow
    //xTypic = (xHigh + xLow + xClose) / 3
    //xMed = (xHigh + xLow) / 2
    //xRange = xHigh – xLow
    Bullish = xClose > xOpen
    Bearish = xClose < xOpen
    Red = Bearish AND (xOpen = xHigh)
    Green = Bullish AND (xOpen = xLow)
    c1=Bullish crosses over Red
    c2=Green crosses under Red

    if c1 and trigger then
    drawarrowup(barindex,lowest[3](low)) coloured(0,255,51)
    //DRAWTEXT(xpip,barindex,highest[8],Dialog,Bold,5) coloured(“Green”)
    endif

    if c2 and trigger then
    drawarrowdown(barindex,highest[3](high)) coloured(102,102,102)
    endif

    return c1 or c2

    #222156 quote
    amitoverseas40
    Participant
    Junior

    I think I sorted the 1st issue with crosses under and over. Now I am getting the right alert.

    Still need help with calculating number of points from last top or bottom to current price, it’s difficult to get around on my own, please help?

    #222158 quote
    amitoverseas40
    Participant
    Junior

    never mind, all sorted now,, thanks!

    robertogozzi thanked this post
    #223329 quote
    daxtrader3
    Participant
    Junior

    @amitoverseas40, how did you to have the arrows on the right place? Thanks in advance

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

Wicks


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
umebon @umebon Participant
Summary

This topic contains 11 replies,
has 5 voices, and was last updated by daxtrader3
2 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 10/20/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...