Buggy Indicator

 

hello

i have this indicator but the sound and the indicator don't work. If you compile it has an error.

Part of the code with a problem is as follows

here is the code as well as the indicator.....I would be very grateful for your time as well as your solution.

int start()

{

double thisCCI;

double lastCCI;

int counted_bars = IndicatorCounted();

if (counted_bars < 0) return (-1);

if (counted_bars > 0) counted_bars--;

int limit = Bars - counted_bars;

for (int shift = limit; shift >= 0; shift--)

{

thisCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift);

lastCCI = iCCI(NULL, 0, CCI, PRICE_TYPICAL, shift + 1);

if (thisCCI >= 0 && lastCCI < 0) bufferUp[shift + 1] = bufferDn[shift + 1];

if (thisCCI 0) bufferDn[shift + 1] = bufferUp[shift + 1];

if (thisCCI >= 0)

{

bufferUp[shift] = Low[shift] - iATR(NULL, 0, ATR, shift);

if (bufferUp[shift] < bufferUp[shift + 1])

bufferUp[shift] = bufferUp[shift + 1];

}

else

{

if (thisCCI <= 0)

{

bufferDn[shift] = High[shift] + iATR(NULL, 0, ATR, shift);
if (bufferDn[shift] > bufferDn[shift + 1])
bufferDn[shift] = bufferDn[shift + 1];
}
}
}
//---- signals
shift=limit-1;
while(shift>=0)
{
if (Signals==true)
{

if (bufferUp < bufferDn && bufferUp[shift] < bufferDn[shift + 1] && TurnedUp==false);

if (bufferUp > bufferDn && bufferUp[shift] > bufferDn[shift + 1] && TurnedUp==true);

// if (ind_buffer2a<ind_buffer1a && ind_buffer2a[i+1]>=ind_buffer1a[i+1]) ind_buffer3=ind_buffer2a-0.0001;
// if (ind_buffer2a>ind_buffer1a && ind_buffer2a[i+1]<=ind_buffer1a[i+1]) ind_buffer4=ind_buffer2a+0.0001;

// if (ind_buffer3[0]==ind_buffer2a[0]-0.0001 && TurnedUp==false)
{
Alert("Trend Magic Buy: ",Symbol()," - ",Period()," at ", Close[0]," - ", TimeToStr(CurTime(),TIME_SECONDS));
TurnedDown = false;
TurnedUp = true;
}
// if (ind_buffer4[0]==ind_buffer2a[0]+0.0001 && TurnedDown==false)
{
Alert("Trend Magic SELL: ",Symbol()," - ",Period()," at ", Close[0]," - ", TimeToStr(CurTime(),TIME_SECONDS));
TurnedUp = false;
TurnedDown = true;
}
}
shift--;
}
//---- done
return (0);

Files:
 
tilex83:
hello i have this indicator but the sound and the indicator don't work. If you compile it has an error.Part of the code with a problem is as followshere is the code as well as the indicator.....I would be very grateful for your time as well as your solution.

This indicator looks unfinished

look:

if (bufferUp < bufferDn && bufferUp[shift] < bufferDn[shift + 1] && TurnedUp==false);

if (bufferUp > bufferDn && bufferUp[shift] > bufferDn[shift + 1] && TurnedUp==true);

semicolon in the end of the strings - means that they have no effect at all.

// if (ind_buffer3[0]==ind_buffer2a[0]-0.0001 && TurnedUp==false)

// if (ind_buffer4[0]==ind_buffer2a[0]+0.0001 && TurnedDown==false)

"if" statement was commented - so signal should appear every time when function is called.

 

maybe you probably paste on notepad first..some comp doesn't lreally can comply with just any code..