OPEN-SOURCE SCRIPT

TREND SNIPER (Final Version)

Atualizado
/ This script calculates the daily resistance and support levels. The entry is when the close breaks these levels.
// Then it sets 4 exit lines, if the [HLC3] backtraces these lines you've got your normal [green] exit.
// If the close crosses the TP you've got your TP [blue] exit. And if the close crosses the SL you've got your SL [red] exit.
// This is the good part --> If the close crosses the first line the SL get's raised to the entry level.
// This way you cut down on the SL losses and turn a lot of SL trades into (almost) break even trades.
// You can adjust the resistance and support levels to remove the 'little wick entries', this raises the profitability.
// You can also choose the security resolution. I recommend using a higher timeframe than the chart resolution.
// The exit source is also changeable. The HLC3 works best for me, but you can try others if you want.

I could really use some feedback. I want the resistance and support levels to remain on the same position when in trade. But it sometimes changes mid trade.
If you know how to fix this I will be forever grateful. If you have any feedback don't hesitate to give it to me straight. Thanks in advance and have a wonderful day :)
Notas de Lançamento
Made some adjustments so the settings menu looks a lot clearer and it's more intuitive to use. Also cleaned up the code a little bit and removed some options I made for testing.
Notas de Lançamento
Fixed a stupid mistake :P
Notas de Lançamento
I cleaned up the code a little bit more. No structural changes, only optical.
Notas de Lançamento
I think I fixed the problem of the moving resistance/support lines mid trade. In a very easy way also by using barstate.isnew. It now uses the values on the start of every candle. I also changed the entry source because the HLC3 uses the close and therefore gives different results on the chart then in real life.
Notas de Lançamento
Because I was using the HL2/HLC3 source, the charted results did not match the alert results. So I created the OH2 and OL2 which better suit the purpose. I've also tried to further limit the amount of SL trades by adding the purple line, which sits between the resistance/support and the first black line. This is the value the trailing SL uses and is also a back-tracing line. Furthermore I fixed the error that when there's a entry and exit on the same candle it didn't show the right BG color and bar color. I also made some changes to make it look better.
Notas de Lançamento
There can be a difference between chart results and alert results. That's because of the entry and exit sources. So I made a couple of options that don't use the close and i've added the close for if you want to use the close anyway. I also fixed the problem of false results because of a moving resistance/support line mid candle. It now uses the value it had at the start of the previous candle. Which means it now lags one bar behind but I don't think this will be a problem. Also fixed some plotshape color errors due to recent changes.
Notas de Lançamento
MAJOR UPDATE !

I've been very busy making the chart results match the alert results, and doing my best to ensure the resistance/support levels don't change mid trade. I think I fixed those errors and the indicator is much closer to reality now. I also fixed some plotshape errors so now all colors match with what happens. Even on the one candle trades everything matches. These changes make it easier to backtest results and make them more accurate. A 100% perfect precision doesn't exist but I think, with these changes, the indicator gets close.

I also added an optional function; SL Protection. It's sound really cool but all it does is cancel a trade if there was a SL trade less then 3 bars ago. This way you don't have to worry about 2 or 3 SL trades in a row within a small timeframe. It might block some good trades as well, so you must calculate if it is worth using.

So far I haven't really received any feedback. If you got a minute to spare, please let me know what you think of it and/or where you want to see improvement. I would really appreciate it !
codingfeedbacksnipersupportSupport and Resistancetrend

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?

Aviso legal