Renko ALF Buy & Sell Signal Alerts showing repeated alerts

#1
Dear Experts,

I am new to use Amibroker. I have a renko code as below. When i run this code in scan, it shows repeatedly alerts in AlertsOutput window, however, on chart it shows only one buy and sell signal. Kindly help me on the issue :

_SECTION_BEGIN("Renko Chart");
// Renko Chart

SetBarsRequired(10000,10000);

// Brick size is dependant on what you want, if too small will not produce a chart due to insufficient x-axis bars
//Brick = LastValue( ATR(100) );
//Brick = LastValue( Max(0.02*C, 0.05) );
Brick = Param( "Brick Size", 0.50, 0.01, 50.00, 0.01 );
reversal = 2;

// Convert the closing price to rising and falling rounded bricks
CF = ceil(C/Brick);
CR = floor(C/Brick);

// initialize first element
j = 0;
RKC[j] = CF[0];
RKO[j] = CF[0] + 1;

down[j] = 1; // By default the first bar is a down bar.
up[j] = 0;

// Loop to produce the Renko values in number of bricks

for( i=1; i<BarCount-1; i++ )
{
if( CF <= RKC[j] - 1 && down[j] ) // Continue down
{
num = RKC[j] - CF;
for( x=1; x<=num; x++ )
{
j++;
up[j] = 0;
down[j] = 1;
RKC[j] = RKC[j-1] - 1;
RKO[j] = RKC[j] + 1;
}
}
else
{
if( CR >= RKC[j] + Reversal && down[j] ) // Change down to up
{
num = CR - RKC[j];
j++;
up[j] = 1;
down[j] = 0;
RKC[j] = RKC[j-1] + 2;
RKO[j] = RKC[j] - 1;
for( x=2; x<=num; x++ )
{
j++;
up[j] = 1;
down[j] = 0;
RKC[j] = RKC[j-1] + 1;
RKO[j] = RKC[j] - 1;
}
}
else
{
if( CR >= RKC[j] + 1 && up[j] ) // Continue Up
{
num = CR - RKC[j];
for( x=1; x<=num; x++ )
{
j++;
Up[j] = 1;
Down[j] = 0;
RKC[j] = RKC[j-1] + 1;
RKO[j] = RKC[j] - 1;
}
}
else
{
if( CF <= RKC[j] - Reversal && up[j] ) // Change up to down
{
num = RKC[j] - CF;
j++;
Up[j] = 0;
Down[j] = 1;
RKC[j] = RKC[j-1] - 2;
RKO[j] = RKC[j] + 1;
for( x=2; x<=num; x++ )
{
j++;
up[j] = 0;
down[j] = 1;
RKC[j] = RKC[j-1] - 1;
RKO[j] = RKC[j] + 1;
}
}
}
}
}
}

// move the chart to right end of chart space, ie last brick on last bar position
delta = BarCount-1 - j;

RKC = Ref( RKC, -delta );
RKO = Ref( RKO, -delta );

up = Ref( Up, -delta );
down = Ref( Down, -delta );


rC = RKC * Brick;// + (Up-down)*Brick/2;
rO = RC - (Up-down)*Brick;
rH = Max(rC,rO);
rL = Min(rC,rO);

Buy = Up > Down ;
Sell = Up < Down;

Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);

PlotShapes(shapeUpArrow*Buy,colorWhite);
PlotShapes(shapeDownArrow*Sell,colorYellow);


AlertIf( Sell, "", "Sell_Renko-Test"+FullName()+ "@"+SELLPrice,2 );
AlertIf( Buy, "", "Buy_Renko-Test"+FullName()+ "@"+buyPrice,1 );

PlotShapes(shapeUpArrow*Buy,colorWhite);
PlotShapes(shapeDownArrow*Sell,colorYellow);


C = RKC * Brick;// + (Up-down)*Brick/2;
O = C - (Up-down)*Brick;
H = Max(C,O);
L = Min(C,O);

Plot( C, "", colorGrey50,styleCandle);
// plot chart
plotOHLC( rO, rH, rL, rC, "Renko Price " , colorgreen, styleCandle);
GraphXSpace=5;

Title = Name() + " - {{INTERVAL}} {{DATE}} - Renko Chart : Last Value = " + RKC * Brick + ", Brick Size = " + Brick;



_SECTION_END();
 

Attachments

#2
Dear Experts,

I am new to use Amibroker. I have a renko code as below. When i run this code in scan, it shows repeatedly alerts in AlertsOutput window, however, on chart it shows only one buy and sell signal. Kindly help me on the issue :

_SECTION_BEGIN("Renko Chart");
// Renko Chart

SetBarsRequired(10000,10000);

// Brick size is dependant on what you want, if too small will not produce a chart due to insufficient x-axis bars
//Brick = LastValue( ATR(100) );
//Brick = LastValue( Max(0.02*C, 0.05) );
Brick = Param( "Brick Size", 0.50, 0.01, 50.00, 0.01 );
reversal = 2;

// Convert the closing price to rising and falling rounded bricks
CF = ceil(C/Brick);
CR = floor(C/Brick);

// initialize first element
j = 0;
RKC[j] = CF[0];
RKO[j] = CF[0] + 1;

down[j] = 1; // By default the first bar is a down bar.
up[j] = 0;

// Loop to produce the Renko values in number of bricks

for( i=1; i<BarCount-1; i++ )
{
if( CF <= RKC[j] - 1 && down[j] ) // Continue down
{
num = RKC[j] - CF;
for( x=1; x<=num; x++ )
{
j++;
up[j] = 0;
down[j] = 1;
RKC[j] = RKC[j-1] - 1;
RKO[j] = RKC[j] + 1;
}
}
else
{
if( CR >= RKC[j] + Reversal && down[j] ) // Change down to up
{
num = CR - RKC[j];
j++;
up[j] = 1;
down[j] = 0;
RKC[j] = RKC[j-1] + 2;
RKO[j] = RKC[j] - 1;
for( x=2; x<=num; x++ )
{
j++;
up[j] = 1;
down[j] = 0;
RKC[j] = RKC[j-1] + 1;
RKO[j] = RKC[j] - 1;
}
}
else
{
if( CR >= RKC[j] + 1 && up[j] ) // Continue Up
{
num = CR - RKC[j];
for( x=1; x<=num; x++ )
{
j++;
Up[j] = 1;
Down[j] = 0;
RKC[j] = RKC[j-1] + 1;
RKO[j] = RKC[j] - 1;
}
}
else
{
if( CF <= RKC[j] - Reversal && up[j] ) // Change up to down
{
num = RKC[j] - CF;
j++;
Up[j] = 0;
Down[j] = 1;
RKC[j] = RKC[j-1] - 2;
RKO[j] = RKC[j] + 1;
for( x=2; x<=num; x++ )
{
j++;
up[j] = 0;
down[j] = 1;
RKC[j] = RKC[j-1] - 1;
RKO[j] = RKC[j] + 1;
}
}
}
}
}
}


// move the chart to right end of chart space, ie last brick on last bar position
delta = BarCount-1 - j;


RKC = Ref( RKC, -delta );
RKO = Ref( RKO, -delta );


up = Ref( Up, -delta );
down = Ref( Down, -delta );



rC = RKC * Brick;// + (Up-down)*Brick/2;
rO = RC - (Up-down)*Brick;
rH = Max(rC,rO);
rL = Min(rC,rO);


Buy = Up > Down ;
Sell = Up < Down;


Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);


PlotShapes(shapeUpArrow*Buy,colorWhite);
PlotShapes(shapeDownArrow*Sell,colorYellow);



AlertIf( Sell, "", "Sell_Renko-Test"+FullName()+ "@"+SELLPrice,2 );
AlertIf( Buy, "", "Buy_Renko-Test"+FullName()+ "@"+buyPrice,1 );


PlotShapes(shapeUpArrow*Buy,colorWhite);
PlotShapes(shapeDownArrow*Sell,colorYellow);



C = RKC * Brick;// + (Up-down)*Brick/2;
O = C - (Up-down)*Brick;
H = Max(C,O);
L = Min(C,O);


Plot( C, "", colorGrey50,styleCandle);
// plot chart
plotOHLC( rO, rH, rL, rC, "Renko Price " , colorgreen, styleCandle);
GraphXSpace=5;


Title = Name() + " - {{INTERVAL}} {{DATE}} - Renko Chart : Last Value = " + RKC * Brick + ", Brick Size = " + Brick;



_SECTION_END();
show error
 

Similar threads

Broker Special Offers

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?