mickes Aggiornato   
Hi all!

This script is based on the concept of "higher highs and higher lows" and "lower highs and lower lows". Bullish/bearish trend changes when a previous pivot (low in bullish trend and high in bearish trend) is broken (or has equal value). Some settings are customizable by the user:

  • Timeframe
    - You can choose what timeframe the pivots are found on
  • Left length
    - The left length used for the pivots found
  • Right length
    - The right length used for the pivots found
  • Show labels
    - Choose if you want to display buy and sell labels
  • Show pivots
    - Choose if you want to display the pivots found
  • Show MSS
    - Choose if you want to display a line when price breaks a previous pivot

The "look and feel" is inspired by the script "SuperTrend" by KivancOzbilgic (www.tradingview.com/v/r6dAP7yi/).

Best of trading luck!
Note di rilascio:
  • add 'Agressive' setting to let you set new trends as soon as price breaks a pivot. If set, a trend changes from bear to bull when the high breaks the low pivot, otherwise it's the low of the candle. The reverse in a bullish trend. If this is unchecked the bar must be closed.
  • add 'High volume' setting to let you decide if you want the breakout candle to have large volume. The volume for the breakout candle needs to be larger than the simple moving average (length: 20) to count.
  • add 'Trade info in buy/sell label' to show the return for the latest trade in buy/sell labels. If the current label is 'Sell', then it shows the return on the latest buy trend, and vice versa.
  • sort settings into groups
  • change alert frequency from 'freq_all' to 'freq_once_per_bar'
  • code refactoring
Note di rilascio:
Hi all!

This is a major update that I hope will make the indicator better. Let me know what you think and if something is unclear.

  • Change default pivot lengths to 3/3
  • "Aggressive" is replaced by "Breakout source", the current settings can be choosed:
    - High/low - same as not aggressive before
    - High/low (aggressive) - same as aggressive before
    - Close - new option to have the breakout price close above/below
  • Add "Pivots lookback" to let you choose the number of pivots instead of only the having the latest high/low pivot
  • Trend statistics is now available in the trend for the label (not the previous trend)

I think that's all for now. Good luck trading!
Note di rilascio:
Hi all!

An update with major changes. From you being able to set the number of pivots lookback in the settings, the indicator now looks at the latest (one high and one low) pivots. The pivots are split into high and low pivots, and can have separate timeframes, lengths and sources. The pivot source is new and can be any of ohlc values.

The defaults are changed to fit my trading (long entries on the daily timeframe). The lengths of the low pivots found are 4 (left) and 2 (right) and is found on the higher (weekly) timeframe. The breakout source is changed to 'close', so the bar needs to close above or below to be considered broken.

The bar that breaks the pivot no longer need to have high volume as default (still available to set). I've found that the low pivots are best with a 'low' source in US markets, but can be good with 'close' on others.

Trade information is based on 'On bar close' as a default as I think you will be able to change your market position before close, if the trend is not changed on the bar close. You are also available to display the bars ago that the pivot that was broken was found (on as default).

Think that's all, good luck trading!
Note di rilascio:
Hi all!

• Change default breakout source to "High/low (aggressive)"
• You can now choose from the following for the breakout source:
- 'High/low (aggressive)'
As soon as the price goes above/below the pivot, a trend change will happen.
- 'Close (current price)'
Will behave the same as 'High/low (aggressive)' on realtime bars, but the same as 'Close' on historical bars.
- 'Open'
The bar's open price, historical or realtime is irrelevant.
- 'High/low'
The high/low of a historical/closed bar.
- 'Close'
The actual close value of a closed bar.
• You can fire an alert on the close of the bar. The trend might change and be different when the bar closes. Therefore you can have an alert fired when the bar closes (with this option) if an alert was previously fired on the bar. This, in theory, invalidates any backtesting since the results cannot be trusted. However this is useful in live trading since you have to wait for the bar to close for alerts to be fired otherwise, this symptom is widely known as 'repainting'. If 'High/low (aggressive)' or 'Open' is not used for the breakout source the bar needs to be closed for the trend to change, thus firering the alert later than the other options. Then this option has no effect.
• The trades yield/return had a bug calculating the closing price one bar late, this is now mitigated

Think that's all, good luck trading!
Note di rilascio:
Hi again!

Just an update fixing a bug having alerts fire twice. Set 'alerted' to true if an alert has been sent.
Note di rilascio:
Hi all!

Major update here.

The gist is that you can now choose lookback for pivots, not only the latest (as before). You can also choose to have a trend change needing to be a retest. I will try to explain all the changes:

• Pivot lookback can be configured (the default being 3)
• Retest can be configured to be needed separately
- high pivots (start of bull trend)
- low pivots (start of beat trend)
By default (from testing) retest are enabled for low pivots.
• These retest can be configured separately and is based on Average True Range (ATR). The price must move, in the trend change way, by as much configured by the ATR factor. Then it must move back, in the opposite direction, to the pivot price and then have a reaction in the trend change way. The trend is changed if the price turns back in the trend change way above/below the pivot price. You can also configure a "Wait" (defaults to 2) after a retest. This "Wait" waits for the price to be in the right direction of the pivot price (above/below) for the retest to be considered real.
• Code refactoring
This is major change to make the code easier to read. Casing is changed to PascalCase and camelCase for variables. The new keyword in Pine Script; "method" is used a lot to use dot notation.

Hope these changes makes sense and makes the indicator better, let me know if you have any questions. These changes makes the script more advanced, but hopefully they are good. If you want the script to behave like before you can change the lookback to 1 and turn off any retesting.

Good luck trading!
Script open-source

Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.

Vuoi usare questo script sui tuoi grafici?