Need AFL help

#1
Hi Seniors,

I want to plot lines in such a way that the lines show up on:

1. 5% of High-Low added to yesterdays high.
eg: High=500 Low=450
High-Low=50
5% of 50=2.5
Line should plot at 500+2.5= 502.5

Same way second line 2.5 below 450
450-2.5= 447.5

I tried much but am not good in creating afls with such calculations.

Any help would be much appreciated.

Thanks.
 

casoni

Well-Known Member
#2
Hello ,
i hope,, this is what you are looking for

HTML:
Plot(C,"",3,64);
dH1=  TimeFrameGetPrice("H",inDaily,-1);
dL1=  TimeFrameGetPrice("L",inDaily,-1);
yrng=(dH1-dL1);
rrp=Optimize("room%",Param("room%",5,1,10,0.5),1,10,0.5);
room=(yrng*rrp)/100;

Plot( dh1, "\nHighest  between ", 2,  styleDashed);
Plot( dl1, "\nLowest  between  ", 2,   styleDashed);

Plot( dh1+room, "\nHighest  between ", 2,  styleThick);
Plot( dl1-room, "\nLowest  between  ", 2,   styleThick);
 
#3
Thanks Casoni,

It worked. But the problem is it also plots on previous days also. This eats up most of the space in the chart.

Is it possible that these lines get plotted only for the current day.

Thanks again.
 

casoni

Well-Known Member
#4
oaky..
check this

Plot(C,"",3,64);
dH1= TimeFrameGetPrice("H",inDaily,-1);
dL1= TimeFrameGetPrice("L",inDaily,-1);
yrng=(dH1-dL1);
rrp=Optimize("room%",Param("room%",5,1,10,0.5),1,10,0.5);
room=(yrng*rrp)/100;

today=Day()==LastValue(Day());

//Plot( dh1, "\nHighest between ", 2, styleDashed);
Plot(IIf(today,dh1,Null),"",colorTan,1);
//Plot( dl1, "\nLowest between ", 2, styleDashed);
Plot(IIf(today,dl1,Null),"",colorTan,1);

//Plot( dh1+room, "\nHighest between ", 2, styleThick);
Plot(IIf(today,dh1+room,Null),"",colorGold,8);
//Plot( dl1-room, "\nLowest between ", 2, styleThick);
Plot(IIf(today,dl1-room,Null),"",colorGold,8);
 
#5
Thanks Casoni, That worked perfect...

-------------

I tried the same combinations with the following AFL, plotting the lines only for today. But could not succeed. Please help.

_SECTION_BEGIN("Pivot");

SetChartOptions(0,chartShowArrows|chartShowDates,0);
GraphXSpace=12;

mode = ParamList("Display", "Pivot Point|CDP|3 Level Price" );



PH = TimeFrameGetPrice( "H", inDaily, -1 );
PL = TimeFrameGetPrice( "L", inDaily, -1 );
PC = TimeFrameGetPrice( "C", inDaily, -1 );
PT=PH-PL;

//3 Level Price
UP=round(PL+PT*1.382);
MI=round((PH+PL)/2);
DN=round(PH-PT*1.382);

Plot( MI,"",42,32+512+4096);
Plot( SelectedValue(MI) , "",42,16);
Plot( UP,"",4,32+512+4096);
Plot( SelectedValue(UP) , "",4,16);
Plot( DN,"",34,32+512+4096);
Plot( SelectedValue(DN) , "",34,16);

_SECTION_END();
 
#6
Hello Casoni,

Is there a coded line that will help plot any line in an AFL for the current day.

Am new to AFLs, struggling hard to learn.

Thanks,
John.
 

casoni

Well-Known Member
#8
Hello Casoni,

Is there a coded line that will help plot any line in an AFL for the current day.

Am new to AFLs, struggling hard to learn.

Thanks,
John.
hello john.
try this

today=Day()==LastValue(Day());

Plot(IIf(today,MI,Null),"",42,1);
Plot(IIf(today,SelectedValue(MI),Null), "",42,8);

Plot(IIf(today,UP,Null),"",4,1);
Plot(IIf(today,SelectedValue(UP),Null), "",4,8);

Plot(IIf(today,DN,Null),"",34,1);
Plot(IIf(today,SelectedValue(DN) ,Null), "",34,8);

thank you
 
#10
hello john.
try this

today=Day()==LastValue(Day());

Plot(IIf(today,MI,Null),"",42,1);
Plot(IIf(today,SelectedValue(MI),Null), "",42,8);

Plot(IIf(today,UP,Null),"",4,1);
Plot(IIf(today,SelectedValue(UP),Null), "",4,8);

Plot(IIf(today,DN,Null),"",34,1);
Plot(IIf(today,SelectedValue(DN) ,Null), "",34,8);

thank you
******************************

Thanks casoni,

You are really wonderful. I am still new to AFL codes and trying to learn.

Once again to bother you, is there any way an afl can be turned into an Exploration AFL. Any guide or any codes if you could help.

Thanks
John.
 

Similar threads