The following reference sample will provide you with guidance to accomplish what you are looking to do.
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
Better Volume Indicator HELP
Collapse
X
-
Originally posted by suburban View PostBen
I know the data I need sits in a local variable called bc. How can I make that variable global or create a global variable which would have the information contained in local variable bc. This new global variable would have to be accessable by another indicator.
Try removing the 'if' statement and testing it by printing out the results:
Print(CurrentBar.ToString()+" "+BetterVolume(5,false,true).Values[5][0]);
or
Print(CurrentBar.ToString()+" "+BetterVolume(5,false,true).LowChurnBar[0]);
That would verify whether the results are being returned properly. If they are, then the bit you call 'CODE' is probably the problem.
-Alex
Comment
-
Mission Accomplished
It works now. What I did was create a dataseries call Btype which was global in the BetterVolumeIndicator. Then I have my customer indicator calling Btype and it is getting the proper response.
BetterVolume(5,false,true).Btype[0]==5
within the BetterVolume Indicator I amended the if statements to include my new btype dataseries which is then set by each condition.
vxr.Set(v * range);
vdr.Set((range != 0.0) ? v / range : 0.0);
if (v == MIN(Volume, lookback)[0]) {bc = 1;btype.Set(1);} //LowBar;
if (vxr[0] == MAX(vxr, lookback)[0]) { bc = 2; ++cc;btype.Set(2);} //ClimaxBar
if (vdr[0] == MAX(vdr, lookback)[0]) { bc = 3; ++cc;btype.Set(3);} //ChurnBar
if (cc == 2) {bc = 4;btype.Set(4);} //ClimaxChurnBar;
if (vdr[0] == MIN(vdr, lookback)[0]) {bc = 5;btype.Set(5);} //LowChurnBar
Thank you all for your help. It is greatly appreciated.
Comment
-
You could have made 'bc' a series too.
Either way, I'm not sure why that's necessary, but at least it's working for you.
-Alex
Comment
-
??
Originally posted by anachronist View PostNo, the data you need does not sit in a local variable called bc. 'bc' is merely an index value that references one of the 6 plots in the indicator. You can use a number in its place. The number 5 corresponds to LowChurnBar. That is, BetterVolume(5,false,true).Values[5][0] should contain the current value of LowChurnBar.
Try removing the 'if' statement and testing it by printing out the results:
Print(CurrentBar.ToString()+" "+BetterVolume(5,false,true).Values[5][0]);
or
Print(CurrentBar.ToString()+" "+BetterVolume(5,false,true).LowChurnBar[0]);
That would verify whether the results are being returned properly. If they are, then the bit you call 'CODE' is probably the problem.
-Alex
Comment
-
I don't know, I don't use Market Analyzer. In any case, the indicator being discussed in this thread is out of date. The author of BetterVolume updated his algorithm, and some time ago I ported it to NinjaTrader. It may be in the NT7 file area.
(Note, I don't use this indicator myself, so I have no recommendation about its suitability for anything).
-Alex
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by RookieTrader, Today, 09:37 AM
|
3 responses
15 views
0 likes
|
Last Post Today, 10:32 AM | ||
Started by kulwinder73, Today, 10:31 AM
|
0 responses
5 views
0 likes
|
Last Post
by kulwinder73
Today, 10:31 AM
|
||
Started by terofs, Yesterday, 04:18 PM
|
1 response
23 views
0 likes
|
Last Post
by terofs
Today, 10:14 AM
|
||
Started by CommonWhale, Today, 09:55 AM
|
1 response
4 views
0 likes
|
Last Post Today, 10:11 AM | ||
Started by Gerik, Today, 09:40 AM
|
2 responses
7 views
0 likes
|
Last Post
by Gerik
Today, 10:04 AM
|
Comment