grd974
06-30-2007, 01:01 AM
Could anyone explain to me the reason why, when I put this code in a strategy script, it draws Fibonacci retracements over my chart but when I put it in an indicator it does not.
protected override void OnBarUpdate()
{
// Condition set 1
if (High[0] == MAX(High, 34)[0])
{
RemoveDrawObjects();
DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MIN(Low, 34)[0], 0, High[0]);
PlaySound("DRUM.wav");
}
// Condition set 2
if (Low[0] == MIN(Low, 34)[0])
{
RemoveDrawObjects();
DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MAX(High, 34)[0], 0, Low[0]);
PlaySound("REMD.wav");
}
// Condition set 3
if (CrossAbove(Close, SMA(Close, 100), 1))
{
PlaySound("ringout.wav");
}
// Condition set 4
if (CrossBelow(Close, SMA(Close, 100), 1))
{
PlaySound("online.wav");
}
}
Gérard
protected override void OnBarUpdate()
{
// Condition set 1
if (High[0] == MAX(High, 34)[0])
{
RemoveDrawObjects();
DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MIN(Low, 34)[0], 0, High[0]);
PlaySound("DRUM.wav");
}
// Condition set 2
if (Low[0] == MIN(Low, 34)[0])
{
RemoveDrawObjects();
DrawFibonacciRetracements("My fibonacci retracements" + CurrentBar, 1, MAX(High, 34)[0], 0, Low[0]);
PlaySound("REMD.wav");
}
// Condition set 3
if (CrossAbove(Close, SMA(Close, 100), 1))
{
PlaySound("ringout.wav");
}
// Condition set 4
if (CrossBelow(Close, SMA(Close, 100), 1))
{
PlaySound("online.wav");
}
}
Gérard