ROC function needed

Posted By: Smallz

ROC function needed - 09/28/19 15:43

Hi guys

I want to create a new trading system.

Part of it needs an RoC (Rate of Change function), which is based on the simple moving average.

For example, we want to understand how much % the MA (50) has changed over the last 5 bars on GBPUSD. If the value on bar 1 has been 1.30100 and the value on bar 5 is 1.29600, then the rate of change would be -500 ticks, or -0.38%.
If the value on bar 1 has been 1.30100 and the value on bar 5 is 1.30600, then the rate of change would be 500 ticks, or +0.38%


I should be able to use it the SMA function, so the code would look like below

vars RoCvalues = series(RoC(SMA(Price,50),5));

How can I implement this?
Posted By: AndrewAMD

Re: ROC function needed - 09/28/19 16:38

SMA() needs a vars, but you supplied a var. Make a series for it.

ROC is an existing function in all caps. Lite-C is case sensitive.

ROC() needs a vars, but you supplied a var. Make a series for it.

Note that the manual tells you all of the requirements of these functions. Definitely give it a read.
Posted By: Smallz

Re: ROC function needed - 09/28/19 18:11

Originally Posted by AndrewAMD
SMA() needs a vars, but you supplied a var. Make a series for it.

ROC is an existing function in all caps. Lite-C is case sensitive.

ROC() needs a vars, but you supplied a var. Make a series for it.

Note that the manual tells you all of the requirements of these functions. Definitely give it a read.


Thanks Andrew. Much appreciate the quick reply.
© 2024 lite-C Forums