NexusFi: Find Your Edge


Home Menu

 





CodeQuestion: Indicator only works with Inputs


Discussion in EasyLanguage Programming

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




 
Search this Thread

CodeQuestion: Indicator only works with Inputs

  #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?
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 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 Twitter Reply With Quote
Thanked by:




Last Updated on August 10, 2011


© 2024 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 - Privacy Policy - Downloads - Top
no new posts