NexusFi: Find Your Edge


Home Menu

 





CodeQuestion: Indicator only works with Inputs


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
bjschwenzer
Cleveland, Ohio
 
Posts: 6 since Aug 2011
Thanks Given: 4
Thanks Received: 1

Please explain why the Indicator with no Inputs: does not print the var0 value correctly and the one with Inputs does. Thank you
------Var0 only prints 50-------------------
variables: Price( Close ),Length( 9 );
variables: var0(0);
var0 = RSI( Price, Length ) ;
print("RSI:",var0);
------Var0 prints correct chart values------
Inputs: Price( Close ),Length( 9 );
variables: var0( 0 ) ;
var0 = RSI( Price, Length ) ;
print("RSI:",var0);


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 MooreTech 
Orlando, Florida
 
Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Trading: ES
Posts: 57 since Aug 2010
Thanks Given: 6
Thanks Received: 73



bjschwenzer View Post
Please explain why the Indicator with no Inputs: does not print the var0 value correctly and the one with Inputs does. Thank you
------Var0 only prints 50-------------------
variables: Price( Close ),Length( 9 );
variables: var0(0);
var0 = RSI( Price, Length ) ;
print("RSI:",var0);
------Var0 prints correct chart values------
Inputs: Price( Close ),Length( 9 );
variables: var0( 0 ) ;
var0 = RSI( Price, Length ) ;
print("RSI:",var0);

When defining Inputs, the value is automatically updated on every bar. Therefore, using an input of Price(Close), the Price variable will always hold the closing price of the latest bar.

When defining Variables, the value is not automatically updated on every bar. So when the indicator initially runs, it assigns the variable an initial value, but this value is never updated. You will have to update the variable in order for this to work.

 
Code
variables: Price( Close ),Length( 9 );
variables: var0(0);

// add this line to update variable value
Price=Close;
var0 = RSI( Price, Length ) ;
print("RSI:",var0);


If you have any questions about our products or services please contact me via Private Message
Follow me on X Reply With Quote
Thanked by:




Last Updated on August 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