in PEL, if i want to compare volatility of current bar with last bar, how do i code it?
do i have to add volatility as input or there is something like volatility(length) > volatility(length)[-1]
thanks
how to get volatility of last bar
-
- Posts: 91
- Joined: 10 Dec 2010
- Has thanked: 2 times
- Been thanked: 1 time
- Henry MultiСharts
- Posts: 9165
- Joined: 25 Aug 2011
- Has thanked: 1264 times
- Been thanked: 2957 times
Re: how to get volatility of last bar
Hello martingale,
Check if the prebuilt Volatility function works for your calculation.
Store the value it calculates on each bar in a variable and compare the current variable value with the previous one.
Check if the prebuilt Volatility function works for your calculation.
Store the value it calculates on each bar in a variable and compare the current variable value with the previous one.
-
- Posts: 91
- Joined: 10 Dec 2010
- Has thanked: 2 times
- Been thanked: 1 time
Re: how to get volatility of last bar
hi HenryHello martingale,
Check if the prebuilt Volatility function works for your calculation.
Store the value it calculates on each bar in a variable and compare the current variable value with the previous one.
prebuilt volatility function works,
how to store them in each bar and reference the value in next bar?
thanks
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: how to get volatility of last bar
martingale,
you can store the function's return value in a variable and use this variable within your code.
Regards,
ABC
you can store the function's return value in a variable and use this variable within your code.
Code: Select all
Input:
Length( 14 ) ;
Variable:
vVolatility( 0 );
vVolatility = Volatility( Length ) ;
Plot1( vVolatility, "Volatility" ) ;
ABC
-
- Posts: 91
- Joined: 10 Dec 2010
- Has thanked: 2 times
- Been thanked: 1 time
Re: how to get volatility of last bar
is the vVolatility an array or just a scalar value in this case?
if i'd refer to vVolatility value of 10 bars ago, i can just use vVolatility(-10)?
thanks
if i'd refer to vVolatility value of 10 bars ago, i can just use vVolatility(-10)?
thanks
martingale,
you can store the function's return value in a variable and use this variable within your code.
Regards,Code: Select all
Input: Length( 14 ) ; Variable: vVolatility( 0 ); vVolatility = Volatility( Length ) ; Plot1( vVolatility, "Volatility" ) ;
ABC
- ABC
- Posts: 722
- Joined: 16 Dec 2006
- Location: www.abctradinggroup.com
- Has thanked: 125 times
- Been thanked: 410 times
- Contact:
Re: how to get volatility of last bar
martingale,
vVolatility is a variable and you can back reference previous bar's values for variables using a number in square brackets.
vVolatility[0] is the value on the current bar (although [0] is usually omitted), vVolatility[1] is the value one bar to the left of the current bar etc..
Regards,
ABC
vVolatility is a variable and you can back reference previous bar's values for variables using a number in square brackets.
vVolatility[0] is the value on the current bar (although [0] is usually omitted), vVolatility[1] is the value one bar to the left of the current bar etc..
Regards,
ABC