Classical Momentum indicator variation - EL study question
I am wondering if someone could give me some help with this experimental "project". I am reading the "Getting Started with EasyLanguage for TradeStation", but even if it seems like that it has been written in a easy understandable way I do not get it as easy as I would like to.
What I am trying to do is to use the classical Momentum indicator as foundation to produce two different values from two different functions which I then would like to come out as one value on the charts. The goal is to make it have more sensitive and larger oscillations to see if it can be better in showing divergences than the classical one.
The first function is thought as a 8 period momentum study of the Momentum indicator, and the second as a short 5 period, 5 period smoothed Momentum. If these numbers will be any good I do not know, but they are set as a starter.
In the indicator this would be "Plot1(_MOMENTUMMom+_MOMENTUMSmo,"Momentum X") ;" where the "...Mom" is the momentum function study and the "...Smo" the short period smoothed function study.
The _MOMENTUMMom is basically set up as:
MOM = (Momentum(CLOSE,12)8 Bars Ago) ;
The _MOMENTUMSmo is basically set up as:
SMO = (Momentum(CLOSE,5)5 Bars Ago) ;
As you see the way it is now it will not plot. After what I have understood the momentum and smoothing studies "Bars Ago" parts of the functions are also wrong.
“If you wish to see the truth, then hold no opinions for or against anything.” - Hsin Hsin Ming
Favorite Futures: spot fx, currency futures, GC, ES
Posts: 30 since Nov 2010
Thanks: 6 given,
I think you misunderstand a bit how EL is operating with historical data. This misunderstanding comes from the hidden use of types in EL, without mandatory explicit declarations. In fact, EL has 3 types of variables: simple, series and reference. A simple variable can be declared only in the input for a function. A series variable is what is created with "var:" statement. It's an array without a fixed size and it does not require to always use  to access its elements. Thus, standard variables as close, high, low, time, date, etc., are all series. And reference variables are also used in functions, they serve to return more than 1 value from a function.
Now closer to your issue. You try to get a value of a function N bars ago. It cannot be done with a function itself, as function is not variable. So, you may want to write something like this:
The last line can be replaced with simply
Now, as you mentioned smoothing the momentum, I believe you mean some moving averages over it, so let's assume you want to use SMA:
This will give you a 5-period momentum smoothed with a 5-period SMA.
Hope I got your issue right. If this is not the answer to your question, please feel free to ask.
The following 2 users say Thank You to Doctor Leo for this post: