I'm in need of assistance. I'm working on a retracement strategy which can use Fibonacci retracements as retracement levels.
More specifically only certain price levels i.e. percentages and over different time periods.
I'm able to work with Draw.FibonacciRetracements and the respective access to the PriceLeves collection. What I'm struggling with are mainly the timeframes.
My current approach is to call Draw.FibonacciRetracements on each bar update, disabling (depending on the setttings) unwanted price levels, color the plotted ones as configured and then add the price value of the selected level to retrace on to the respective series. The main method looks like this:
private void UpdateFibLevels()
{
FibRetracers.Add(FibRetraceLevel.Monthly, Draw.FibonacciRetracements(this, "Monthly", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.Weekly, Draw.FibonacciRetracements(this, "Weekly", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.Daily, Draw.FibonacciRetracements(this, "Daily", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.QuarterDay, Draw.FibonacciRetracements(this, "QuarterDay", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.Hourly, Draw.FibonacciRetracements(this, "Hourly", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.QuarterHour, Draw.FibonacciRetracements(this, "QuarterHour", true, 10, Low[10], 0, High[0]));
FibRetracers.Add(FibRetraceLevel.FiveMin, Draw.FibonacciRetracements(this, "FiveMin", true, 10, Low[10], 0, High[0]));
foreach (KeyValuePair<FibRetraceLevel, FibonacciRetracements> kvp in FibRetracers)
{
foreach (PriceLevel plvl in kvp.Value.PriceLevels)
{
if (plvl.Value == 61.8)
{
if (!ShowFib61)
plvl.IsVisible = false;
else
plvl.Stroke.Brush = FibBrushes[kvp.Key];
}
else if (plvl.Value == 76.4)
{
if (!ShowFib76 && RLevel != RetraceLevel.Fibonacci)
plvl.IsVisible = false;
else
plvl.Stroke.Brush = FibBrushes[kvp.Key];
if (RLevel == RetraceLevel.Fibonacci && FibRLevel == kvp.Key)
RSeries[0] = plvl.GetPrice(kvp.Value.StartAnchor.Price, kvp.Value.EndAnchor.Price - kvp.Value.StartAnchor.Price, false);
}
else
plvl.IsVisible = false;
}
}
}
The startBarsAgo, startY etc. params are currently placeholder. Not only am I stuck how to get the respective timeframes, I'm also not sure whether this is the right approach in the first place.
The reason I want to use the Draw.FibonacciRetracements instead of calculating the price levels manually, is to make use of the drawn elements.

Comment