I'm working on a divergence indicator. I have a block of code that helps me find the lowest low for a given period:
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); }
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.
Comment