NexusFi: Find Your Edge


Home Menu

 





CodeQuestion: Indicator only works with Inputs


Discussion in EasyLanguage Programming

Updated
    1. trending_up 3,445 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?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
Cheap historycal L1 data for stocks
Stocks and ETFs
What broker to use for trading palladium futures
Commodities
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
24 thanks
What is Markets Chat (markets.chat) real-time trading ro …
19 thanks
ApexTraderFunding.com experience and review
16 thanks
GFIs1 1 DAX trade per day journal
12 thanks
EG Indicators
11 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