TradingView
Trendoscope
Jun 27, 2021 1:26 PM

Double Top/Bottom 

Alibaba Group Holding LimitedNYSE

描述

Here is an attempt to identify double top/bottom based on pivot high/lows.

Logic is simple.

Double Bottom:
  • Last two pivot High Lows make W shape
  • Last Pivot Low is higher than previous Last Pivot Low.
  • Last Pivot High is lower than previous last Pivot High.
  • Price has not gone below Last Pivot Low
  • Price breaks out of last Pivot High to complete W shape


Double Top:
  • Last two pivot High Lows make M shape
  • Last Pivot Low is higher than previous Last Pivot Low.
  • Last Pivot High is lower than previous last Pivot High.
  • Price has not gone above Last Pivot High
  • Price breaks out of last Pivot Low to complete M shape


Prameters:

  • Parameters PvtLenL, PvtLenR and waitforclose determines pivot points.
  • FilterPivots clears repetitive pivots formed in same direction before calculating the possible double top/bottom.

    For example:
  • CheckForAbsolutePeaks and AbsolutePeakLoopback works together. When CheckForAbsolutePeaks is enabled, script only generates double bottom or top signal if previous last pivot is absolute high or low for AbsolutePeakLoopback periods.

  • ConsiderMovingAverage does two things. First, it makes sure that fast moving average and slow moving averages are aligned with the direction we are going to forecast. Second, it makes sure that the crossover happend recently and with last BarCrossoverLimit bars. For example, to call it double bottom, Fast MA should be higher than Slow MA and crossover of FastMA above SlowMA should have happened in last 10 bars (BarCrossoverLimit)

  • PivotDisplayMode can be Actual, Filtered or None. Actual will display all pivot high low generated. Filtered will only display last 5 pivot high and pivot lows which are filtered. That means, it will remove the repetitive pivots formed without making pivots on the other side.

    Welcome and suggestions and feedbacks.

版本注释

  • Simplied array related code
  • Added horizontal dashed line for double top/bottom confirmation candle
  • Added alert condition for double top/bottom

版本注释

Add filterPivots logic back

版本注释

  • Improved filtering pivots
  • Improved absolute peak detection

版本注释

  • Using HMA 20/100 as default for moving average check
  • Removed barCrossLimit. Instead check if moving average crossover happened after last high/last low peaks.
  • Added condition to check distance between High and Low pivots of double top/bottom before considering them. For example,
    Without pivot distance check, chart would look like this:

    With pivot distance check,


评论
zeynebozkan0901
Thank you! Q - Is there an alert function to let me know when double tops/bottoms are formed?
Trendoscope
@zeynebozkan0901, I will add that in the next release.
egranville
Dear HWMNBN, (see what I did there? I didn't name you...or did I by not doing so?...lost myself)
Small question. Are the HH HL LL LH 's calculated on a later bar or on their bar close?
Thank you!
pricechart1336
Thanks for all wonderful efforts
just_naba
as always great done,,,thanks
utshahr
Nice work . thanks
ks1267
Hi, is there anything I can set on this indicator to be able to show exactly same position of double top/double bottom as your "Double Top/Bottom - Ultimate (OS)" indicator? I prefer the double top/double bottom position on that indicator than this one because I think it's more accurate. However, there is a big delay till the signal show up (the signal come up after 3-10 bar pass by) while this indicator gives instant alert after there is a double top/double bottom signal showing up.
JoshuaMcGowan
this is rad!
AminHa4
@HeWhoMustNotBeNamed forgive me ... I made a copy of your code ...
Trendoscope
@AminHa4, No worries. You can use the code and build on top of it. Thats the intent of open source. If you are intending to publish it, just go through the house rules once on reusing code - there are few rules around it.
更多