Profile Picture

Custom Indicator with external values (not based on bar data)

Posted By pcintra 4 Years Ago

Custom Indicator with external values (not based on bar data)

Message
Posted Thursday June 06 2013
Hello.

I’m trying to setup a indicator that looks into a external database to get the values. For that I need to know the date/time and the symbol name of each bar.

I think I’m doing the right thing, I have a test indicator that is calculated whit the components of the date/time of the bar (indicator = day, very stupid…) , it shows correctly in the graph, but I have one problem: how to get the symbol name during processing?

With symbol name and date/time I can find the correct value for the indicator in my data base.

Bellow the working code.

public override RList CalcSeriesValues(RList bars)
{
RList indicatorValues = base.CalcSeriesValues(bars);
for (int sx = 0; sx < bars.Items.Count; sx++)
{
BarData item = bars.Items[(bars.Items.Count - 1) - sx];
indicatorValues.SetValue(sx, item.BarStartTime.Day);
}
return indicatorValues;
}

I’m sorry if the code is stupid, but I have several doubts about the processing of the system, I will appreciate suggestions.

Tks in advance,
Paulo
Posted Thursday June 06 2013
use Symbol


Posted Friday June 07 2013
I've tried this, but 'Symbol', in the context of a "IndicatorBase->CalcSeriesValues" is just a class name, not a instance.

I have found many references to this variable in trading systems, but no one in the context of indicators...

Is it possible to know the symbol name?

tks
Posted Sunday June 09 2013
Sorry read it wrong. Thought it was in a system not a indicator. Only way I can think of is to pass it as an input?


Posted Sunday June 09 2013
Implement the ISystemAccess interface in your indicator, and RightEdge will call the Initialize() method to pass it the symbol it applies to.

Thanks,
Daniel
Posted Wednesday June 12 2013
Hi Daniel.

It didn't work..

Look my code and the log created, method Initialize was not called. What is wrong?

public class Exs1m : IndicatorBase, ISystemAccess

{

private Symbol symbol = null;

public Exs1m()

: base()

{

Util.Util.WriteLog("instanciação de Exs1m", DateTime.Now, "rightEdge", "txt", @"c:\");

}

public void Initialize(SystemData systemData, Symbol p_symbol)

{

this.symbol = p_symbol;

Util.Util.WriteLog("Initialize " + this.symbol.Name, DateTime.Now, "rightEdge", "txt", @"c:\");

}

public override RList<double> CalcSeriesValues(RList<BarData> bars)

{

Util.Util.WriteLog("CalcSeriesValues", DateTime.Now, "rightEdge", "txt", @"c:\");

RList<double> indicatorValues = base.CalcSeriesValues(bars);

Util.Util.WriteLog("CalcSeriesValues - pos base.CalcSeriesValues", DateTime.Now, "rightEdge", "txt", @"c:\");

for (int sx = 0; sx < bars.Items.Count; sx++)

{

BarData item = bars.Items[(bars.Items.Count - 1) - sx];

double value = item.BarStartTime.Day;

indicatorValues.SetValue(sx, value);

}

}

Util.Util.WriteLog(string.Format("CalcSeriesValues processou {0} itens", bars.Items.Count), DateTime.Now, "rightEdge", "txt", @"c:\");

return indicatorValues;

}

}

log created:

2013.06.12, 22:21:12 => instanciação de Exs1m
2013.06.12, 22:25:45 => CalcSeriesValues
2013.06.12, 22:25:45 => CalcSeriesValues - pos base.CalcSeriesValues
2013.06.12, 22:26:13 => CalcSeriesValues processou 50000 itens

tks,

Paulo

Posted Thursday June 13 2013
Are you using this in a system or only on a chart? If in a system, when are you creating the indicator and how are you storing it? Is RightEdge calling CalcSeriesValues or are you doing that directly in your code?

Thanks,
Daniel
Posted Thursday June 13 2013
Hi Daniel.

I'm using in charts, just to plot my indicator.

tks,
Paulo


Similar Topics


Reading This Topic


2005-2017 © RightEdge Systems