Reversal point indicator

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #113907 quote
    Rocketship
    Participant
    Veteran

    There seems to be a problem with this indicator in the library.

    It only returns the long signal.

    I cannot code, so will appreciate any help with repairing the code.

    //PRC_Reversal point indicator | indicator
    //09.04.2017
    //Nicolas @ www.prorealcode.com
    //Sharing ProRealTime knowledge
    //https://www.prorealcode.com/topic/need-help-coding-the-following-reversal-indicator/
    
    // LONG
    //Red/Green candle (reversal)
    //Bullish candle close above the open of the previous red candle
    //Space to the left (the low of the last 3 candles lower than the low of the last 50 candles)
    //default stochastic (8,3,3) was in the oversold area within the last 3 candles
    
    sto = stochastic[8,3]
    
    c1 = close[1]<open[1] and close>open
    c2 = close>open[1]
    c3 = lowest[3](low)<lowest[50](low)[1] or lowest[3](low)<lowest[50](low)[2] or lowest[3](low)<lowest[50](low)[3]
    c4 = summation[3](sto<20)>0
    long = c1 and c2 and c3 and c4
    
    if long then
    drawarrowup(barindex,lowest[3](low)) coloured(0,255,0)
    endif
    
    // SHORT
    //Green/Red candle (reversal)
    //Bearish candle close below the close of the previous green candle
    //Space to the left (the high of the last 3 candles higher than the high of the last 50 candles)
    //default stochastic (8,3,3) was in the overbought area within the last 3 candles.
    
    c5 = close[1]>open[1] and close<open
    c6 = close<open[1]
    c7 = highest[3](high)>highest[50](high)[1] or highest[3](high)>highest[50](high)[2] or highest[3](high)>highest[50](high)[3]
    c8 = summation[3](sto>80)>0
    short = c5 and c6 and c7 and c8
    
    if short then
    drawarrowdown(barindex,highest[3](high)) coloured(255,0,0)
    endif
    
    return long as "long reversal", short as "short reversal"
    

     

    #113915 quote
    Nicolas
    Keymaster
    Master

    The short signals work ok with this code. I think that you didn’t see any short signals because the conditions were not respected. Switch instrument or timeframe and you’ll find many long/short signals.

    reversal-point-indicator-short-signals.png reversal-point-indicator-short-signals.png
    #189958 quote
    Yann LB
    Participant
    Average

    Hello Nicolas,
    I do not understand lines 17 (and 33), more specifically what [1] [2] and [3] apply to.
    Can you please explain?

    #189962 quote
    robertogozzi
    Moderator
    Master

    [3] is the number of bars to be scanned.

    [2] is the index to the prior bar where the scan has to start, it means the second previous start (the current bar is [0], or missing).

    #189969 quote
    Yann LB
    Participant
    Average

    Hi Roberto,
    Thank you for the answer.

    c3 = lowest[3](low)<lowest[50](low)[1] or lowest[3](low)<lowest[50](low)[2] or lowest[3](low)<lowest[50](low)[3]
    
    

    So, we are looking for “the low of the last 3 candles lower than the low of the last 50 candles”(it’s OK with me) and we start the calculation on the previous bar

    or we are looking for “the low of the last 3 candles lower than the low of the last 50 candles” and we start the calculation on the second previous bar
    or we are looking for “the low of the last 3 candles lower than the low of the last 50 candles” and we start the calculation on the third previous bar  .

    Is it correct?

    #189970 quote
    robertogozzi
    Moderator
    Master

    Yes, that’s correct.

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

Reversal point indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Rocketship @rocketship Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/29/2019
Status: Active
Attachments: 1 files
Logo Logo
Loading...