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
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]; }
}
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:
The following user says Thank You to chrisflow for this 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
The following 3 users say Thank You to eDanny for this post:
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
The following 2 users say Thank You to max-td for this post: