NexusFi: Find Your Edge


Home Menu

 





Classical Momentum indicator variation - EL study question


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,743 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
Laurus12's Avatar
 Laurus12 
Norway
 
Experience: Advanced
Platform: MultiCharts, CQG, NinjaTrader
Broker: CQG, DTN IQFeed
Trading: EURO
Posts: 376 since Nov 2010
Thanks Given: 566
Thanks Received: 364

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.

Thanks,
Laurus


“If you wish to see the truth, then hold no opinions for or against anything.” - Hsin Hsin Ming
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
I Have a Thing Called Iran -- Trump Stays in DC as Airsp …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
SEC Chairman Calls for New Golden Age of SEC-CFTC Regula …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Hello Im new here
5 thanks
  #3 (permalink)
Doctor Leo
St. Petersburg, Russia
 
Posts: 30 since Nov 2010
Thanks Given: 6
Thanks Received: 19


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:

 
Code
var: mom;

value1 = momentum(close, 12);
mom = value1 8 bars ago;
The last line can be replaced with simply

 
Code
mom = value1[8];
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:

 
Code
var: mom_smoothed;

value1 = momentum(close, 5);
mom_smoothed = average(value1, 5);
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.


Reply With Quote
Thanked by:
  #4 (permalink)
 
Laurus12's Avatar
 Laurus12 
Norway
 
Experience: Advanced
Platform: MultiCharts, CQG, NinjaTrader
Broker: CQG, DTN IQFeed
Trading: EURO
Posts: 376 since Nov 2010
Thanks Given: 566
Thanks Received: 364

Just sent you a PM Leo.

Laurus


“If you wish to see the truth, then hold no opinions for or against anything.” - Hsin Hsin Ming
Started this thread Reply With Quote




Last Updated on April 10, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts