Raghee Horner Grab Candles Adjustments

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #212089 quote
    Edoardo
    Participant
    New

    Hello everyone,

    I have worked on an indicator to make it more accurate and added the evaluation of market volatility using the Average True Range (ATR). I made some changes to the indicator code which can be found at this link: https://www.prorealcode.com/prorealtime-indicators/raghee-horner-grab-candles/.

    I would like to compare my new indicator with the original one to evaluate the effectiveness of my changes and get your feedback based on your experience.

    Thank you in advance for your comments.

    Edo

    a = ExponentialAverage[34](High)
    b = ExponentialAverage[34](Low)
    c = AverageTrueRange[14](Close)
    
    if Close > a + c / 2 Then
    DRAWCANDLE(Open, High, Low, Close)COLOURED(0,255,0)
    
    ELSIF  Close < b - c / 2 Then
    DRAWCANDLE(Open, High, Low, Close)COLOURED(255,0,0)
        
    else
    DRAWCANDLE(Open, High, Low, Close)COLOURED(0,0,255)
        
    endif
    
    RETURN
    
    #212090 quote
    robertogozzi
    Moderator
    Master

    It doesn’t look much different; it seems that green and red candle sequences are a little be more fragmented sometimes.

    The most effective way is to have the same strategy coded for both of them, then comparing the results.

    Edoardo thanked this post
    #212096 quote
    JS
    Participant
    Senior
    Hi,

    What do you mean by “effectiveness”…?

    More profit or a better win percentage, lower drawdown or more robust… etc…?

    What is your main goal…?

    What you’re doing now is putting an extra band, of half an ATR, around the original band…

    As a result, the number of trades will decrease and (probably) also the profit…

    #212106 quote
    Edoardo
    Participant
    New
    Hi JS, by “effectiveness” I meant to achieve both greater profits and a better winning percentage. I thought that by making the sideways movements clearer, it would be possible to improve the safety of the entries. Thanks! Edo
    #212107 quote
    JS
    Participant
    Senior

    Hi Edo,

    I compared the two systems and as expected the number of trades has decreased but the % win trades have increased from 62% to 67%…

    The profit has also decreased, but with a good MM system that can be absorbed…

    In general, I think that the modified system is less stable partly because another variable has been added which must probably be optimized…

    I have expanded the original system with a simple MM system and the profit has increased from 14,000 to 151,000…

    #212124 quote
    Edoardo
    Participant
    New
    Hi JS, Thank you very much for this in-depth analysis and for sharing statistics and reasoning. I have a question: how did you integrate my new indicator into the strategy to make a comparison between systems? Would you be able to share the code? Thank you in advance. Have a nice Sunday. Edo
    #212126 quote
    JS
    Participant
    Senior

    Hi Edo,

    Hereby the custom code…

    DefParam CumulateOrders = False
    
    Once EMAPeriod = 26
    Once ADXPeriod = 6
    Once ATRPeriod = 14
    Once TStart = 20 //Trailing Start
    Once TStep = 2 //Trailing Step
    
    a=exponentialaverage [EMAPeriod] (high) //Upper Grab
    b=exponentialaverage [EMAPeriod] (low) //Lower Grab
    c=AverageTrueRange[ATRPeriod](close)
    d=ADX[ADXPeriod] //Average Directional Index
     
    If Close > a+c/2 and Close[1] < a+c/2 and d > 25 then //Start UpTrend and ADX>25
    Buy 1 contract at Market
    EndIf
     
    if Close < b-c/2 and Close[1] > b-c/2 and d > 25 then //Start DownTrend and ADX>25
    SellShort 1 contract at Market
    EndIf
    
    //************************************************************************
    //trailing stop function
    trailingstart = TStart //trailing will start @trailinstart points profit
    trailingstep = TStep //trailing step to move the "stoploss"
    
    //reset the stoploss value
    IF NOT ONMARKET THEN
    newSL=0
    ENDIF
    
    //manage long positions
    IF LONGONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND close-tradeprice(1)>=trailingstart*pipsize THEN
    newSL = tradeprice(1)+trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND close-newSL>=trailingstep*pipsize THEN
    newSL = newSL+trailingstep*pipsize
    ENDIF
    ENDIF
    
    //manage short positions
    IF SHORTONMARKET THEN
    //first move (breakeven)
    IF newSL=0 AND tradeprice(1)-close>=trailingstart*pipsize THEN
    newSL = tradeprice(1)-trailingstep*pipsize
    ENDIF
    //next moves
    IF newSL>0 AND newSL-close>=trailingstep*pipsize THEN
    newSL = newSL-trailingstep*pipsize
    ENDIF
    ENDIF
    
    //stop order to exit the positions
    IF newSL>0 THEN
    SELL AT newSL STOP
    EXITSHORT AT newSL STOP
    ENDIF
    //************************************************************************
    GraHal and Edoardo thanked this post
Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.

Raghee Horner Grab Candles Adjustments


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
Edoardo @sparrowhawk Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by JS
2 years, 10 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 03/25/2023
Status: Active
Attachments: 1 files
Logo Logo
Loading...