NexusFi: Find Your Edge


Home Menu

 





What does "Value" represents?


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 wolfcuring 
ChangChun+China
 
Experience: Intermediate
Platform: Ninja Trader 8
Trading: Futures
Posts: 4 since Oct 2011
Thanks Given: 1
Thanks Received: 0

Hi all,

Sorry for the simplicity of my question. I am learning to code, and stuck with the first example I am reading: SMA.

protected override void OnBarUpdate()
{
if (CurrentBar == 0)
Value.Set(Input[0]);
else
{
double last = Value[1] * Math.Min(CurrentBar, Period);

if (CurrentBar >= Period)
Value.Set((last + Input[0] - Input[Period]) / Math.Min(CurrentBar, Period));
else
Value.Set((last + Input[0]) / (Math.Min(CurrentBar, Period) + 1));
}
}

It seems that Value[1] here should represent the median one bar ago, is this correct?

I tested the the "Value[0]" on a chart, but it shows that it is equal to Close[0].

Quite confused with how NinjaScript would process price data .


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
Prediction Markets Lock Fed Pause at 99pct for April 29 …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
CFTC Workforce Shrinks 24% to 15-Year Low While Predicti …
Traders Hideout
Kraken Becomes First US Digital Asset Bank With Direct F …
Cryptocurrency
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,715 since May 2010
Thanks Given: 203
Thanks Received: 2,688


Value represents the numeric value of the primary (1st plot) of the indicator. By default, this is initialized to the close price of the underlying data series if your indicator does not set the value to something else.


Follow me on X Reply With Quote
Thanked by:




Last Updated on December 20, 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