NexusFi: Find Your Edge


Home Menu

 





What does "Value" represents?


Discussion in NinjaTrader

Updated
    1. trending_up 4,178 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?
Would a node-based workflow for automated trading be useful?
Traders Hideout
May 26 Deadline Dies at 7.5% as US Strikes Iran During C …
Prediction Markets & Event Contracts
Czechia Live at 52.5% as England Rides 4-2 Wave to Co-Fa …
Prediction Markets & Event Contracts
Trump Media to sell instant access to market-moving soci …
Traders Hideout
CPI Eve: Fed Hike Odds Hold at 52% for the First Time, I …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 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,689


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