Could you please write this simple AFL for...

#1
Hi AFL pundits,

1. Please help write AFL for appearing candle numbers beneath the candles on 5 min intra-day chart (please look at the attached chart). Starting from 9:15 AM to 3:30 AM, a total of 375 minutes will give 75 candles. Alternate numbering like 2, 4, 6.....so on will be good. I want the number should appear after the close of the the current candle.

2. I want Yesterday's high & Yesterday's low to appear on intra-day chart. Some kind of a mark or symbol like a dash -- or a star * would be good.

Thanks in advance.
buskar7
 

Attachments

#3
Hi original, thanks for your question.

I discuss my charts/trading with a very successful trader on another forum, I think it is often convenient to be able to refer to the bar(s) on my chart by number. This is one of the main purposes.
 

sudris

Well-Known Member
#4
Code:
/////by Sudris!/////
for( i = 0; i < BarCount; i++ ) 

PlotText(StrLeft(NumToStr(i), StrFind(NumToStr(i),".")) , i, L[ i ]-(L[i])*0.001, colorBlue);

Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0); 

Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0); 

Plot(C,"Close",1,styleCandle);
Hi original, thanks for your question.

I discuss my charts/trading with a very successful trader on another forum, I think it is often convenient to be able to refer to the bar(s) on my chart by number. This is one of the main purposes.
strategies from one forum and charting formulas from another... no fair!!!

on a serious note, the bar numbers would start looking ugly if the number of digits exceed 3 or 4 may be! ;)
 
#5
Thanks Sudris for your help.

You are right, bar numbers started looking ugly after the number of digits exceed 3 or 4.

In the other forum no one knows about Amibroker, so I had to ask for help here.

But I am looking for bar numbering to start freshly every day @ market start. For eg., @ the finish of 2nd 5 minutes bar @ 9:24 am I would want no. 2 to appear beneath the candle & after finishing 4th bar I want no. 4 to appear beneath it & so on. Alternate numbering such as 2, 4, 6, 8....so on... will do (I have attached a picture in the 1st post).

I hope this will not take too much of your time. Thanks in advance.

buskar7


/////by Sudris!/////
for( i = 0; i < BarCount; i++ )

PlotText(StrLeft(NumToStr(i), StrFind(NumToStr(i),".")) , i, L[ i ]-(L)*0.001, colorBlue);

Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0);

Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0);

Plot(C,"Close",1,styleCandle);


strategies from one forum and charting formulas from another... no fair!!!

on a serious note, the bar numbers would start looking ugly if the number of digits exceed 3 or 4 may be!
 

sudris

Well-Known Member
#6
Thanks Sudris for your help.

You are right, bar numbers started looking ugly after the number of digits exceed 3 or 4.

In the other forum no one knows about Amibroker, so I had to ask for help here.

But I am looking for bar numbering to start freshly every day @ market start. For eg., @ the finish of 2nd 5 minutes bar @ 9:24 am I would want no. 2 to appear beneath the candle & after finishing 4th bar I want no. 4 to appear beneath it & so on. Alternate numbering such as 2, 4, 6, 8....so on... will do (I have attached a picture in the 1st post).

I hope this will not take too much of your time. Thanks in advance.

buskar7


/////by Sudris!/////
for( i = 0; i < BarCount; i++ )

PlotText(StrLeft(NumToStr(i), StrFind(NumToStr(i),".")) , i, L[ i ]-(L)*0.001, colorBlue);

Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0);

Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0);

Plot(C,"Close",1,styleCandle);


strategies from one forum and charting formulas from another... no fair!!!

on a serious note, the bar numbers would start looking ugly if the number of digits exceed 3 or 4 may be!


Seems I misread your first post and went by the image you had posted.

Alternating bar numbers couldn't be fit in the code syntax.
In 5 minutes interval it will look better if only the chart is zoomed a bit. Any time interval onwards 10 minutes should you give decent looking bars with the number below them.

Numbers will only be displayed for the recent/last day in Db. if any bar is selected, these numbers will change!

below is the code

Code:
GraphXSpace=5;

iBars = BarsSince(Day()!= Ref(Day(),-1) );

for( i = BarCount-(LastValue(iBars)+1); i < BarCount; i++)

{

j=abs((BarCount-2*i-(iBars-i)-2));

PlotText(StrLeft(NumToStr(j),StrFind(NumToStr(j),".")-1), i, L[i]-L[i]*0.001, colorBlue);

}

Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0); 

Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0); 

Plot(C,"",1,styleCandle);
 

bharatk8

Active Member
#7
Dear Sudris,

I need numbers from 1 to 5 on candles.i.e. 12345 12345 12345 ........Pl. help
Seems I misread your first post and went by the image you had posted.

Alternating bar numbers couldn't be fit in the code syntax.
In 5 minutes interval it will look better if only the chart is zoomed a bit. Any time interval onwards 10 minutes should you give decent looking bars with the number below them.

Numbers will only be displayed for the recent/last day in Db. if any bar is selected, these numbers will change!

below is the code

Code:
GraphXSpace=5;

iBars = BarsSince(Day()!= Ref(Day(),-1) );

for( i = BarCount-(LastValue(iBars)+1); i < BarCount; i++)

{

j=abs((BarCount-2*i-(iBars-i)-2));

PlotText(StrLeft(NumToStr(j),StrFind(NumToStr(j),".")-1), i, L[i]-L[i]*0.001, colorBlue);

}

Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0); 

Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0); 

Plot(C,"",1,styleCandle);
 

casoni

Well-Known Member
#8
Hello,
check this :) ,
Thank you

code

GraphXSpace=5;
SetChartOptions(0, chartShowArrows|chartShowDates);
percent = Param( "PositText%", 3, 0, 90, 0.5 );
Miny = Status( "axisminy" );
Maxy = Status( "axismaxy" );
y = Miny + ( Maxy - Miny ) * percent / 100;
begbar = Status( "firstvisiblebar" ) ;
iBars = BarsSince(Day()!= Ref(Day(),-1) );
cas=(Day()!= Ref(Day(),-1));
Plot(cas,"",47,styleHistogram|styleDashed|styleNoLabel|styleOwnScale,0,1);
for( i = BarCount-(LastValue(iBars)+1); i < BarCount; i++)
{
j=abs((BarCount-2*i-(iBars-i)-2));
//PlotText(StrLeft(NumToStr(j),StrFind(NumToStr(j),".")-1), i, L-L*0.001, colorBlue);
PlotText(StrLeft(NumToStr(j),StrFind(NumToStr(j),".")-1),i, y, colorGreen);
}
//Plot(TimeFrameGetPrice("H", inDaily, -1),"Y'Day High",4,0);
//Plot(TimeFrameGetPrice("L", inDaily, -1),"Y'Day Low",5,0);
Plot(C,"",31,styleCandle);

this will plot y'day High-Low

H1= TimeFrameGetPrice("H",inDaily,-1);
L1= TimeFrameGetPrice("L",inDaily,-1);
Plot(H1,"",colorLightYellow,1|styleNoRescale|styleNoLabel);
Plot(L1,"",colorLightYellow,1|styleNoRescale|styleNoLabel);
 
Last edited:
#9
Casoni, thank you very much for your help. I have been looking for something like this for some time.

Unfortunately I am getting some error with AFL. Could you please have a look @ the attached picture & correct?

Thanks gain. Cheers!
 

Attachments

Similar threads

Broker Special Offers

Intraday Higher Leverage

Save up to 90% in brokerage and get higher leverage for intraday trades.

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