I am struggling for many hours to find a way to test for a new Low / High as a week progresses.
I have a simple code (see below) and I need to test on all remaining days of week (i.e Tue, Wed, Thu, Fri) if higher high or lower low was created in the market. If yes I would like to use that High / Low in my doubles instead of the value they take on Monday. If now I want the doubles to keep values from Monday.
I have read many threads but came to no result.
Any idea on how I could proceed will be much appreciaed.
My code:
protected override void OnBarUpdate()
{
double WavgHigh = Low[0]*(1.022);
double WavgHigh1dev = Low[0]*(1.032);
double WavgHigh2dev = Low[0]*(1.042);
double WavgLow = High[0]*(1-0.022);
double WavgLow1dev = High[0]*(1-0.032);
double WavgLow2dev = High[0]*(1-0.042);
{
if (Time[0].DayOfWeek == DayOfWeek.Monday)
{
DrawText("W avg. high" + CurrentBar, false, "W avg. High", 0, WavgHigh, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
DrawText("W avg. high 1 dev", false, "W avg. High 1dev", 0, WavgHigh1dev, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
DrawText("W avg. high 2 dev", false, "W avg. High 2dev", 0, WavgHigh2dev, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
DrawText("W avg. low", false, "W avg. Low", 0, WavgLow, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
DrawText("W avg. low 1 dev", false, "W avg. Low 1dev", 0, WavgLow1dev, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
DrawText("W avg. low 2 dev", false, "W avg. Low 2dev", 0, WavgLow2dev, 0, Color.Black, new Font("Arial", 8), StringAlignment.Center, Color.Blue, Color.Transparent, 0);
}
else
{
}
}
}
Comment