// bc = bar color = index number of plot created in Initialize() bool sameday = eod ? true : (Time[0].Day == Time[1].Day); bc = 0; // default 0 (normal volume bar) if (cond1 || (cond11 && sameday)) { bc = 1; //LowVol } if (cond2 || cond3 || cond8 || cond9 || ((cond12 || cond13 || cond18 || cond19) && sameday)) { bc = 2; //ClimaxUp } if (cond4 || cond5 || cond6 || cond7 || ((cond14 || cond15 || cond16 || cond17) && sameday)) { bc = 3; //ClimaxDown } if (cond10 || (cond20 && sameday)) { bc = 4; //Churn } if (bc == 4 && (cond2 || cond3 || cond4 || cond5 || cond6 || cond7 || cond8 || cond9 || (cond12 || cond13 || cond14 || cond15 || cond16 || cond17 || cond18 || cond19) && sameday)) { bc = 5; //ClimaxChurn } // plot stuff Values[bc][0] = Volume[0]; //draw the volume bar we found if (PaintBars && bc > 0) { BarBrush = Plots[bc].Brush; // paint the price bar } VolEMA[0] = (vwt * (Volume[0] - VolEMA[1]) + VolEMA[1]); // plot average; faster than SMA } // End OnBarUpdate() #region Properties [Browsable(false)] [XmlIgnore] public double SendVolumeBarType { get { return bc; } }
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
bc Value for Better Volume 3 Indicator is One Bar Late
Collapse
X
-
bc Value for Better Volume 3 Indicator is One Bar Late
Hello, I created a buffer to call the bc value in the BetterVolume3 indicator in a strategy. The bc value from 0 to 5 determines the volume bar color. My strategy is set for OnBarClose, and this value is always one bar late. bc value should indicate the volume color for Close[0] in the strategy, but it indicates the volume color for Close[1]. I tried enabling and disabling Use2Bars and it didn't make any difference.
Code:Tags: None
-
Hello ronaldgreene828,
Calculate OnBarClose would mean the logic is evaluated when the bar is fully closed. If you were to color a bar, this would be the most recently fully closed bar, not the currently building bar.
If you want to color the currently building bar, check the logic OnPriceChange or OnEachTick.
Use TickReplay if this needs to work historically.Chelsea B.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by gbourque, Today, 06:39 AM
|
2 responses
14 views
0 likes
|
Last Post
by gbourque
Today, 07:05 AM
|
||
Started by rexsole, Today, 08:39 AM
|
0 responses
4 views
0 likes
|
Last Post
by rexsole
Today, 08:39 AM
|
||
Started by trilliantrader, Yesterday, 03:01 PM
|
3 responses
30 views
0 likes
|
Last Post Today, 08:28 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
4 responses
26 views
0 likes
|
Last Post Today, 08:19 AM | ||
Started by Brevo, Today, 01:45 AM
|
1 response
14 views
0 likes
|
Last Post Today, 08:14 AM |
Comment