NexusFi: Find Your Edge


Home Menu

 





Quickie: How to access multi-plot indicator's values SEPARATELY??


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one chrisflow with 5 posts (1 thanks)
    2. looks_two zeller4 with 2 posts (0 thanks)
    3. looks_3 max-td with 1 posts (2 thanks)
    4. looks_4 eDanny with 1 posts (3 thanks)
      Best Posters
    1. looks_one eDanny with 3 thanks per post
    2. looks_two max-td with 2 thanks per post
    3. looks_3 gregid with 1 thanks per post
    4. looks_4 chrisflow with 0.2 thanks per post
    1. trending_up 8,207 views
    2. thumb_up 7 thanks given
    3. group 4 followers
    1. forum 10 posts
    2. attach_file 1 attachments




 
Search this Thread

Quickie: How to access multi-plot indicator's values SEPARATELY??

  #1 (permalink)
 
chrisflow's Avatar
 chrisflow 
New Orleans, LA
 
Experience: Intermediate
Platform: xtrader ADL, NinjaTrader7
Trading: Guitar and CL
Posts: 15 since Feb 2010
Thanks Given: 54
Thanks Received: 5

This is simple but I can't find the answer anywhere:

I'm programming my own indicator and I want to access another indicator that plots two values (ie MACD Bollinger Bands, or the QQE].

For example how would I access the value of the upper bollinger band independently of the lower one?

For example, the QQE indicator, if you look at the code, uses two public variables, Value0 and Value1 for the two plots it produces. When I access the QQE externally this code only returns one of the plots:

works, but accesses only one of the QQE's two plots:
double tempVariable = QQE(14, 10)[0] // returns only one of the plots data points

I want to access it like this (but all of these tries have returned compiling error):
fails:
double tempVariable = QQE.Value[0](14,10)[0]; // to access Plot 0 data
double tempVariable = QQE.Value[1](14,10)[0]; // to access Plot 1 data

fails:
double tempVariable = Value0.QQE(14,10)[0];
double tempVariable = Value1.QQE(14,10)[0];

fails:
double tempVariable = QQE.(14,10)[0].Value0
double tempVariable = QQE.(14,10)[0].Value1

Aaaargh....



Here is partial code from the QQE in reference to Value0 and Value1:
#region Properties
[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Value1
{
get { return Values[0]; }
}

[Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
[XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
public DataSeries Value2
{
get { return Values[1]; }
}

.... [more]

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Build trailing stop for micro index(s)
Psychology and Money Management
Online prop firm The Funded Trader (TFT) going under?
Traders Hideout
Exit Strategy
NinjaTrader
 
  #3 (permalink)
 
gregid's Avatar
 gregid 
Wrocław, Poland
 
Experience: Intermediate
Platform: NinjaTrader, Racket
Trading: Ockham's razor
Posts: 650 since Aug 2009
Thanks Given: 320
Thanks Received: 623


Try these:

double tempVariable = QQE(14,10).Value1[0]
double tempVariable = QQE(14,10).Value2[0]

Reply With Quote
Thanked by:
  #4 (permalink)
 
chrisflow's Avatar
 chrisflow 
New Orleans, LA
 
Experience: Intermediate
Platform: xtrader ADL, NinjaTrader7
Trading: Guitar and CL
Posts: 15 since Feb 2010
Thanks Given: 54
Thanks Received: 5

Thanks for the help!

I found this to work. Hopefully it doesn't use more resources than necessary but this got it done:

First of all, the variables I was calling from QQE are *DataSeries* so I must create a DataSeries from the calling indicator in which to put the QQE vars (using a type double was like putting a dozen eggs into a the space of one egg and doesn't work):

First I defined a new DataSeries variable:

 
Code
                            
Initialize() 
{
myDataSeries_QQE_PlotA = new DataSeries(this);   
myDataSeries_QQE_PlotB = new DataSeries(this);
}

Then copy the data from the QQE into my current indicator:

OnBarUpdate()
{
// Pull the first plot data out of the QQE
// Values[0] references the QQE public DataSeries variable Value1 which is returned as Values[0]
// The second [0] tells NT to use the CurrentBar (the newest bar)
myDataSeries_QQE_PlotA.Set(QQE(145).Values[0][0]);   

// Pull the second plot data out of the QQE
// Values[1] references the QQE public DataSeries variable Value2 which is returned as Values[1]
// The second [0] tells NT to use the CurrentBar (the newest bar)
myDataSeries_QQE_PLotB.Set(QQE(145).Values[1][0]);


//To print the QQE's latest values in the output window:
Print("Last PlotA value from QQE: " myDataSeries_E_QQE_Value0[0]);
Print(
"Last PlotB value from QQE: " myDataSeries_E_QQE_Value1[0]);
}

[
end]




QQE code referenced here:
******************************************************
region Properties
        
public DataSeries Value1
        
{
            
get { return Values[0]; }
        }



        public 
DataSeries Value2
        
{
            
get { return Values[1]; }
        }************************************************************ 

Started this thread Reply With Quote
Thanked by:
  #5 (permalink)
 
eDanny's Avatar
 eDanny 
East Rochester, NY
 
Experience: Intermediate
Platform: NT
Posts: 329 since Jul 2009
Thanks Given: 18
Thanks Received: 425

That works fine except you are creating two DataSeries for nothing. You could just call the QQE values as you need them like this:

//To print the QQE's latest values in the output window:
Print("Last PlotA value from QQE: " + myDataSeries_E_QQE_Value0[0]);
Print(
"Last PlotB value from QQE: " myDataSeries_E_QQE_Value1[0]);


or do this in Variables:

private Indicator qqeLines;

in OnBarUpdate():

if(CurrentBar == 0)
qqeLines = QQE(14, 5);

//To print the QQE's latest values in the output window:
Print("Last PlotA value from QQE: " +
qqeLines.Values[0][0]);
Print(
"Last PlotB value from QQE: "
+ qqeLines.Values[1][0]);

// Do other stuff with qqeLines below



Reply With Quote
Thanked by:
  #6 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404


eDanny View Post
That works fine except you are creating two DataSeries for nothing. You could just call the QQE values as you need them like this:

//To print the QQE's latest values in the output window:
Print("Last PlotA value from QQE: " + myDataSeries_E_QQE_Value0[0]);
Print("Last PlotB value from QQE: " myDataSeries_E_QQE_Value1[0]);


or do this in Variables:

private Indicator qqeLines;

in OnBarUpdate():

if(CurrentBar == 0)
qqeLines = QQE(14, 5);

//To print the QQE's latest values in the output window:
Print("Last PlotA value from QQE: " +
qqeLines.Values[0][0]);
Print("Last PlotB value from QQE: "
+ qqeLines.Values[1][0]);

// Do other stuff with qqeLines below



Thanks eDanny!

I'm using this and sometimes getting plotvalues in the output and sometimes it's plotting zero...

https://screencast.com/t/MGUyMWY0Z


Not sure what else to change for that. I have the COBC=false...
Thanks for your help.
Kirk

Attached Files
Elite Membership required to download: Other_Indicator_Called.cs
Reply With Quote
  #7 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hey chrisflow,

have you ever tried it with the Ninja-Startegy-wizard, to find out the exact code of the plot you like to grab when using indicators with multiple plots / values like Macd, Boll-bands, QQe etc ?

thats a fast + easy help in my eyes !

max-td
Reply With Quote
Thanked by:
  #8 (permalink)
 
chrisflow's Avatar
 chrisflow 
New Orleans, LA
 
Experience: Intermediate
Platform: xtrader ADL, NinjaTrader7
Trading: Guitar and CL
Posts: 15 since Feb 2010
Thanks Given: 54
Thanks Received: 5

That's neat. Now can this type "Indicator" be declared using the "(this): in order to sync with historical data and so that it updates with each tick?

Started this thread Reply With Quote
  #9 (permalink)
 
chrisflow's Avatar
 chrisflow 
New Orleans, LA
 
Experience: Intermediate
Platform: xtrader ADL, NinjaTrader7
Trading: Guitar and CL
Posts: 15 since Feb 2010
Thanks Given: 54
Thanks Received: 5

Yeah but that would be too easy! Good thinkin'!

Started this thread Reply With Quote
  #10 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404



chrisflow View Post
That's neat. Now can this type "Indicator" be declared using the "(this): in order to sync with historical data and so that it updates with each tick?

Hey Chrisflow,

You got an example for this?

kz

Reply With Quote




Last Updated on June 2, 2010


© 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