Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with divergence idea

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with divergence idea

    Hello,
    I'm working on a divergence indicator. I have a block of code that helps me find the lowest low for a given period:
    Code:
    if(!TSSuperTrend(14,MovingAverageType.HMA,2.618,14,SuperTrendMode.ATR)._trend[0]
                    && Low[1] > Low[0] && Low[0] < curr_Price_Low_Value)
                {    
                    curr_Price_Low_Value         = Low[0];
                    curr_Price_Low_Bar            = CurrentBar; 
                    DrawDot("curr_Price_Low_Value" + CurrentBar, true, 0, curr_Price_Low_Value - .08, Color.Pink);
                    curr_Stoch_Low_Value        = MIN(Stochastics(2,5,1),3)[0];
                    curr_Stoch_Low_Bar            = CurrentBar - LowestBar(Stochastics(2,5,1), 3);
                    curr_DM_Low_Value            = MIN(DM(14).DiMinus, 3)[0];
                    curr_DM_Low_Bar                = CurrentBar - LowestBar(DM(14).DiMinus, 3);
                }
    I have another block of code that sets the previous values that I compare for larger scale divergence. I use the TSSuperTrend to determine the period. I find divergence between the uptrends when a downtrend has broken the pattern.

    My challenge is when I try to find divergence on a minor scale, during the same period.
    So lets say the market is trending down, pulls back for a bar or two, not enough to change trend, and then continues to trend down. My current logic will capture those lows in price and lows with the indicator. But often when price goes lower an indicator will rise and then not make new lows. My current logic changes my indicator values every time price goes lower. Does someone know a better way to do this? Thanks.

    #2
    Hello CaptainAmericaXX,

    Thanks for your post.

    You may want to add a "qualifier" for the values. This would be similar to how the Swing indicator logic works. It uses the "strength" value to basically say if the detected swing high is still the swing high after 5 bars then it is the new swing high, otherwise if a new high is detected within the subsequent 5 bars then the detection is reset to the latest high detected and again would not be "used" until qualified by being the swing high of the last 5 bars. To clarify the strength setting is simply the number of bars to wait to "qualify" as a swing high (or swing low). While this "delays" the display of the swing it reduces "false" swings which sounds very similar to what you are experiencing with your indicator.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    558 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    545 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    547 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X