TradingView
BacktestRookies
27. Apr. 2018 02:20

Percentage Change Function 

Bitcoin / US Dollar Perpetual Inverse Swap ContractBitMEX

Beschreibung

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.
Kommentare
SaumitraSaikar
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.
gopinath007777
how to create an alert condition here
Hamilton_Gilpin
How would I apply this to something like volume?
JustTheCharts
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
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.
JustTheCharts
@BacktestRookies, Thank you... its a matter of time before im going to give in and pay you for what i need.
Mehr