• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    Paul H.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NinjaTrader_Brandon, Today, 10:24 AM
    0 responses
    4 views
    0 likes
    Last Post NinjaTrader_Brandon  
    Started by ptertich, Today, 07:56 AM
    1 response
    9 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by aslane, Today, 08:24 AM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by Capablanca, Yesterday, 05:51 PM
    1 response
    11 views
    0 likes
    Last Post NinjaTrader_PaulH  
    Started by jackt, Today, 07:43 AM
    3 responses
    14 views
    0 likes
    Last Post NinjaTrader_PatrickG  
    Working...
    X