Percentage Change Function

10437 vizualizações
This is little code snippet can be copied and pasted into your own strategies and indicators to easily calculate some interesting percentage change levels within a given lookback period.

The function will return:
  • The price change from the start to the end of the period
  • The price change from the start of the period to the highest point within the period
  • The price change from the start of the period to the lowest point within the period

It was originally intended to be used in conjunction with other scripts to assist with decision making. However, it doesn't look too bad as an indicator and so plots have been added.

For more information regarding the code, some commentary and free tutorials, you can visit the Bactest-Rookies (.com) website.
Script de código aberto

No verdadeiro espírito TradingView, o autor deste script o publicou com código aberto, para que os traders possam compreendê-lo e verificá-lo. Um brinde ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para utilizá-lo em um gráfico.

Quer usar esse script no gráfico?


Hi.. I loved this indicator. Is there any way to use this logic in algo trading? If you can provide some kind of condition would be much much appreciated. Thanks.
how to create an alert condition here
How would I apply this to something like volume?
Is there a way to loop three seperate lookback periods? say 5 10 20?

'inp_lkb = input(5,10,20 title='Lookback Periods')
for each(Lookback_Periods =>

and then maybe some logic to determine if price is narrowing or expanding to open a window for a trade?

BacktestRookies JustTheCharts
Hi @JustTheCharts,
Yes - you could just have three separate inputs and call the function 3 times. An input() cannot return a list as far as I am aware, so you would need 3 separate ones.
+2 Resposta
JustTheCharts BacktestRookies
@BacktestRookies, Thank you... its a matter of time before im going to give in and pay you for what i need.
+2 Resposta