I'm having trouble setting up a basic indicator that can show me support and resistance levels that occur at a specific time.
What seems to happen is that it only actually recognizes when ToTime(Time[0]) == 130000 about 25%, and when ToTime(Time[0]) == 063000 about 10% of the time.
The other issue is that it seems to combine priceLevel1 and priceLevel2 into the same plot rather two separate ones. The other plot is just at 0.
How do I set this up so it will carry the selected price into the next day, and how do I get it to show both plots and not just one.
I'm not trying to set up the Prior Day OCHL Indicator, I'm just using these times as examples.
Bellow is a snippet of my code.
Thank you so much for your time and help!
public class SRLevels : Indicator
{
private double priceLevel1 = 0;
private double priceLevel2 = 0;
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
AddPlot(Brushes.Red, "Level1");
AddPlot(Brushes.Blue, "Level2");
}
}
protected override void OnBarUpdate()
{
if (ToTime(Time[0]) == 130000)
{
priceLevel1 = Close[0];
}
if (ToTime(Time[0]) == 063000)
{
priceLevel2 = Open[0];
}
Level1[0] = priceLevel1;
Level2[0] = priceLevel2;
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> Level1
{
get { return Values[0]; }
}
[Browsable(false)]
[XmlIgnore()]
public Series<double> Level2
{
get { return Values[1]; }
}
}

Comment