Need AFL Help: Previous days High Low Close

mastermind007

Well-Known Member
#31
3DPR what is the meaning of this... thanks for the afl
Think "Pivot" and you'll be able to guess what it means.

If you cannot guess, then select this message in this post to reveal the answer here: 3 Day Pivot Range
 

cellclinic

Well-Known Member
#33
HEY FRIENDS ...

It is plotting only in current days ... it is much better if it is possible to get in each day which will help to back-test or practicing in bar replay ...

Regards ...

Please help me to plot previous days high and low value on intraday price chart

below code will plot only line
_SECTION_BEGIN("PreDay HLC");
//TIME FRAME CALCULATION
H1 = TimeFrameGetPrice("H", inDaily, -1); // yesterdays high
L1 = TimeFrameGetPrice("L", inDaily, -1); // low
C1= TimeFrameGetPrice("C", inDaily, -1); // close
DayO = TimeFrameGetPrice("-1", inDaily); // current day open

//PLOTS

Plot(H1, "",colorRed,styleLine+styleThick+styleNoRescale+st yleNoLabel);
Plot(L1, "",colorBrightGreen,styleLine+styleThick+styleNoLa bel);
Plot(C1, "",colorLightGrey,styleLine+styleNoRescale+styleNo Label);
_SECTION_END();

Thanks
 
#34
dear john,

please help me for my afl.

FOLLOWING NEEDS BELOW

BUY CONDITION: ALL BUY SIGNAL ONLY WILL TAKE HIGH+1 OF THE SIGNAL CANDLE .


SELL CONDITION: ALL SELL SIGNAL ONLY WILL TAKE LOW-1 OF THE SIGNAL CANDLE.



my afl is



_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();



FirstTradeTime = 092500; // Earliest time to take a trade
LastTradeTime = 150000; // Latest time to take new trades
ExitAllPositionsTime = 152500; // Exit all trades

_SECTION_BEGIN("Advanced Trailstop System");



mult=Param("multi", 2.0, 0.1, 10, 0.05);
Aper=Param("ATR period", 7, 2, 100, 1 );
atrvalue=(mult*ATR(aper));

Bs[0]=0;//=L;
L[0]=0;
C[0]=0;

for( i = 9; i < BarCount; i++ )
{
if ( L[ i ] > L[ i - 1 ] AND L[ i ] > L[ i - 2 ] AND L[ i ] > L[ i - 3 ] AND L[ i ] > L[ i - 4 ] AND
L[ i ] > L[ i - 5 ] AND L[ i ] > L[ i - 6 ] AND L[ i ] > L[ i - 7 ] AND L[ i ] > L[ i - 8 ] AND
L[ i ] > L[ i - 9 ] AND C[ i ] > bs[ i - 1 ])
{
bs[ i ] = L[ i ] - ATRvalue[ i ] ;

}
else
{
if ( H[ i ] < H[ i - 1 ] AND H[ i ] < H[ i - 2 ] AND H[ i ] < H[ i - 3 ] AND H[ i ] < H[ i - 4 ] AND
H[ i ] < H[ i - 5 ] AND H[ i ] < H[ i - 6 ] AND H[ i ] < H[ i - 7 ] AND H[ i ] < H[ i - 8 ] AND
H[ i ] < H[ i - 9 ] AND C[ i ] < bs[ i - 1 ] )
{
bs[ i ] = H[ i ] + ATRvalue[ i ];

}
else
{
bs[ i ] = bs[ i - 1];
} }}

//====================================================
//Buy = Cross(EMA(C,per1),EMA(C,per2)) AND (TimeNum() >= FirstTradeTime AND TimeNum() <= LastTradeTime );
//Sell= Cross(EMA(C,per2),EMA(C,per1)) OR TimeNum() >= ExitAllPositionsTime;

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

Mycolor=IIf(C>bs,colorLime,colorRed);
bcolor=IIf(C>bs,colorBlue,colorBlue);
//PlotOHLC( Open, High, Low, Close, "", Mycolor, styleBar| styleThick );
Plot(bs,"ATS",bcolor,1|styleThick);
Buy=Cover=Cross(C,bs)AND (TimeNum() >= FirstTradeTime AND TimeNum() <= LastTradeTime );

Sell=Short=Cross(bs,C) OR TimeNum() >= ExitAllPositionsTime;

shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shapeUpArrow*Buy, colorLime, 0, L, -95 );
PlotShapes(shapeDownArrow*Sell, colorRed, 0, H, -30 );
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
Filter= Buy OR Sell OR Short OR Cover;


Short=Sell AND (TimeNum() >= FirstTradeTime AND TimeNum() <= LastTradeTime );
Cover=Buy OR TimeNum() >= ExitAllPositionsTime;




//=================TITLE================================================================================================

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Advanced Trailstop System " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();



SetPositionSize(1,spsShares);






//SetTradeDelays(1,1,1,1);
 
#36
DEAR SIR,

THANKS FOR YOUR REPLY. BUT THAT AFL WORKING FINE IN MY SYSTEM.

CAN U DO BELOW REQUIREMENTS

dear sir,

my requirement is below



BUY CONDITION: ALL BUY SIGNAL ONLY WILL TAKE HIGH+1 OF THE SIGNAL CANDLE .


SELL CONDITION: ALL SELL SIGNAL ONLY WILL TAKE LOW-1 OF THE SIGNAL CANDLE.

PLEASE SEE THE SCREEN SHOT FOR YOUR REF

This image has been resized. Click this bar to view the full image. The original image is sized 1304x601.


http://imageshack.com/a/img838/3879/xmn2.jpg
--------------------------------------------------------------------------

PLEASE USE THIS AFL----------




_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Advanced Trailstop System");



mult=Param("multi", 2.0, 0.1, 10, 0.05);
Aper=Param("ATR period", 7, 2, 100, 1 );
atrvalue=(mult*ATR(aper));

Bs[0]=0;//=L;
L[0]=0;
C[0]=0;

for( i = 9; i < BarCount; i++ )
{
if ( L[ i ] > L[ i - 1 ] AND L[ i ] > L[ i - 2 ] AND L[ i ] > L[ i - 3 ] AND L[ i ] > L[ i - 4 ] AND
L[ i ] > L[ i - 5 ] AND L[ i ] > L[ i - 6 ] AND L[ i ] > L[ i - 7 ] AND L[ i ] > L[ i - 8 ] AND
L[ i ] > L[ i - 9 ] AND C[ i ] > bs[ i - 1 ])
{
bs[ i ] = L[ i ] - ATRvalue[ i ] ;

}
else
{
if ( H[ i ] < H[ i - 1 ] AND H[ i ] < H[ i - 2 ] AND H[ i ] < H[ i - 3 ] AND H[ i ] < H[ i - 4 ] AND
H[ i ] < H[ i - 5 ] AND H[ i ] < H[ i - 6 ] AND H[ i ] < H[ i - 7 ] AND H[ i ] < H[ i - 8 ] AND
H[ i ] < H[ i - 9 ] AND C[ i ] < bs[ i - 1 ] )
{
bs[ i ] = H[ i ] + ATRvalue[ i ];

}
else
{
bs[ i ] = bs[ i - 1];
} }}

//================================================== ==
Mycolor=IIf(C>bs,colorLime,colorRed);
bcolor=IIf(C>bs,colorBlue,colorBlue);
//PlotOHLC( Open, High, Low, Close, "", Mycolor, styleBar| styleThick );
Plot(bs,"ATS",bcolor,1|styleThick);
Buy=Cover=Cross(C,bs);
Sell=Short=Cross(bs,C);
shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shapeUpArrow*Buy, colorLime, 0, L, -95 );
PlotShapes(shapeDownArrow*Sell, colorRed, 0, H, -30 );
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
Filter= Buy OR Sell OR Short OR Cover;
//=================TITLE============================ ================================================== ==================

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Advanced Trailstop System " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();
 
#38
as per ur query

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Advanced Trailstop System");



mult=Param("multi", 2.0, 0.1, 10, 0.05);
Aper=Param("ATR period", 7, 2, 100, 1 );
atrvalue=(mult*ATR(aper));

Bs[0]=0;//=L;
L[0]=0;
C[0]=0;

for( i = 9; i < BarCount; i++ )
{
if ( L[ i ] > L[ i - 1 ] AND L[ i ] > L[ i - 2 ] AND L[ i ] > L[ i - 3 ] AND L[ i ] > L[ i - 4 ] AND
L[ i ] > L[ i - 5 ] AND L[ i ] > L[ i - 6 ] AND L[ i ] > L[ i - 7 ] AND L[ i ] > L[ i - 8 ] AND
L[ i ] > L[ i - 9 ] AND C[ i ] > bs[ i - 1 ])
{
bs[ i ] = L[ i ] - ATRvalue[ i ] ;

}
else
{
if ( H[ i ] < H[ i - 1 ] AND H[ i ] < H[ i - 2 ] AND H[ i ] < H[ i - 3 ] AND H[ i ] < H[ i - 4 ] AND
H[ i ] < H[ i - 5 ] AND H[ i ] < H[ i - 6 ] AND H[ i ] < H[ i - 7 ] AND H[ i ] < H[ i - 8 ] AND
H[ i ] < H[ i - 9 ] AND C[ i ] < bs[ i - 1 ] )
{
bs[ i ] = H[ i ] + ATRvalue[ i ];

}
else
{
bs[ i ] = bs[ i - 1];
} }}

//================================================== ==
Mycolor=IIf(C>bs,colorLime,colorRed);
bcolor=IIf(C>bs,colorBlue,colorBlue);
//PlotOHLC( Open, High, Low, Close, "", Mycolor, styleBar| styleThick );
Plot(bs,"ATS",bcolor,1|styleThick);

Buy=Cover=Cross(C,bs);
Sell=Short=Cross(bs,C);
Buyt=ValueWhen(Buy,H,1);
Sellt=ValueWhen(Sell,L,1);
Buytt=Cross(H,Buyt);
selltt=Cross(Sellt,L);
Buytt = ExRem(Buytt, Selltt);
Selltt = ExRem(Selltt, Buytt);

PlotShapes(IIf(Buytt, shapeUpTriangle, shapeNone),colorGreen, 0,L, Offset=-30);
PlotShapes(IIf(Selltt, shapeDownTriangle, shapeNone),colorRed, 0,H, Offset=-30);


shape=Buy*shapeUpArrow + Sell*shapeDownArrow;
PlotShapes(shapeUpArrow*Buy, colorLime, 0, L, -95 );
PlotShapes(shapeDownArrow*Sell, colorRed, 0, H, -30 );
SellPrice=ValueWhen(Sell,C,1);
BuyPrice=ValueWhen(Buy,C,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
_SECTION_END();
Filter= Buy OR Sell OR Short OR Cover;
//=================TITLE============================ ================================================== ==================

_SECTION_BEGIN("Title");
if( Status("action") == actionIndicator )
(
Title = EncodeColor(colorWhite)+ "Advanced Trailstop System " + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +
" - " + Date() +" - "+"\n" +EncodeColor(colorRed) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V)+"\n"+
EncodeColor(colorLime)+
WriteIf (Buy , " GO LONG / Reverse Signal at "+C+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+C+" ","")+"\n"+EncodeColor(colorWhite)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"",""));
_SECTION_END();
 
#39
I request all traderji experts
Pls help me simple system

Iam using ema based buy sell. My system is below

Buy=buy abv 30ema high
Sell=sell below 30ema low

I need add exploration

Highest high value for every buy signal
 
#40
I request all traderji experts
Pls help me simple system

Iam using ema based buy sell. My system is below

Buy=buy abv 30ema high
Sell=sell below 30ema low

I need add exploration

Highest high value for every buy signal

Lowest low value of every sell signal.
 

Similar threads