I have following problem. This is my code(edited part):
protected override void Initialize()
{
Add(PeriodType.Minute, 1); // Adds another TimeSeries 1min Array[1]
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Use this method for calculating your indicator values. Assign a value to each
// plot below by replacing 'Close[0]' with your own formula.
// Posouzeni Stoch 2min
if (CCI(14)[0] <= 20
&& Rising(CCI(BarsArray[1],14)) == true)
{
DrawTextFixed("CCI status","CCI OK ", TextPosition.BottomLeft, Color.Black, new Font("Arial", 10), Color.Black, Color.Lime, 10);
}
else
if (CCI(14)[0] >= 80
&& Falling(CCI(BarsArray[1],14)) == true)
{
DrawTextFixed("CCI status","CCI OK ", TextPosition.BottomLeft, Color.Black, new Font("Arial", 10), Color.Black, Color.Lime, 10);
}
else
{
DrawTextFixed("CCI status","CCI NOK ", TextPosition.BottomLeft, Color.Black, new Font("Arial", 10), Color.Black, Color.Red, 10);
}
}
What I want it to do is:
I have the primary Time series 2min.
I want to build an indicator based on CCI.
If CCI on 2min is below 20 and CCI on 1min is rising, print green box saying "CCI OK" . If CCI on 2min is above 80 and CCI on 1min is falling, print green box saying "CCI OK". If anything else print red box saying "CCI NOK"
I used Add(PeriodType.Minute, 1) to add 1min time series and BarsArray[1] to execute it in a code
But I cannot get it working
Can you help please?
Radek
Comment