This is read-only version of AFL library entry. Ability to add user formulas
and comment is only available from members-only area.
Details:
Formula name:
EKEKO SAR-MF
Author/Uploader:
RAFAEL GOMEZ - jq1688n [at] hotmail.com
Date/Time added:
2006-07-30 23:49:54
Origin:
PERU
Keywords:
Level:
semi-advanced
Flags:
system
DISCLAIMER: Most formulas present in AFL on-line library are submitted
by the users and are provided here on an "as is" and "as available" basis.
AmiBroker.com
makes no representations or warranties of any kind to the contents or the operation
of material presented here. We do not maintain nor provide technical support
for 3rd party formulas. Description:
SAR EVENTS WITH SPECIAL PARAMETERS FOR MULTI FRAMES 1 MINUTE, 30 MINUTES (MARKET PROFILE), DAILY, WEEKLY, MOUNTHLY
SUCESS GUYS
Formula:
//this script detect events with SAR indicators whith special parameters for
simulted multi frames times, for this reason is named alineamiento sar
Offset=10;
Filter=1;
NumColumns=4;
Title="Ekeko SAR-MF 1,30,D,W,M";
function MySAR()
{
IAF = Param("sarIAF",0.1,0.01,1,0.01); // acceleration factor
MaxAF = Param("sarMaxAF",0.25,0.01,1.5,0.01); // max acceleration
ASAR = Param( "ASAR", -1, -50, 1000, 1 );
psar = Close; // initialize
long = 1; // assume long for initial conditions
af = IAF; // init acelleration factor
ep = Low[ 0 ]; // init extreme point
hp = High [ 0 ];
lp = Low [ 0 ];
for( i = 2; i < BarCount; i++ )
{
if ( long )
{
psar [ i ] = psar [ i-1 ] + af * ( hp - psar [ i-1 ] );
}
else
{
psar [ i ] = psar [ i-1 ] + af * ( lp - psar [ i-1 ] );
}
reverse = 0;
//check for reversal
if ( long )
{
if ( Low [ i ] < psar [ i ] )
{
long = 0; reverse = 1; // reverse position to Short
psar [ i ] = hp; // SAR is High point in prev trade
lp = Low [ i ];
af = IAF;
}
}
else
{
if ( High [ i ] > psar [ i ] )
{
long = 1; reverse = 1; //reverse position to long
psar [ i ] = lp;
hp = High [ i ];
af = IAF;
}
}
if ( reverse == 0 )
{
if ( long )
{
if ( High [ i ] > hp )
{
hp = High [ i ];
af = af + IAF;
if( af > MaxAF ) af = MaxAF;
}
if( Low[ i - 1 ] < psar[ i ] ) psar[ i ] = Low[ i - 1 ];
if( Low[ i - 2 ] < psar[ i ] ) psar[ i ] = Low[ i - 2 ];
}
else
{
if ( Low [ i ] < lp )
{
lp = Low [ i ];
af = af + IAF;
if( af > MaxAF ) af = MaxAF;
}
if( High[ i - 1 ] > psar[ i ] ) psar[ i ] = High[ i - 1 ];
if( High[ i - 2 ] > psar[ i ] ) psar[ i ] = High[ i - 2 ];
}
}
}
Plot(0,"Null",colorYellow,styleLine|styleNoLabel);
xxxx=SAR(IAF,MaxAF)>Ref(C,-ASAR);//trabajando con close de candela anterior
yyyy=Ref(C,-ASAR)>SAR(IAF,MaxAF) ;
SAREVENTO2=(IIf(yyyy,1,IIf(xxxx,0,1)));
return(SAREVENTO2);
}
function DrawSAR(style)
{
Offset=Offset+10;
if(style == 0)
{
style=in1Minute;
}
TimeFrameSet(style);
SAREVENTO2=TimeFrameExpand(MySAR(),style);
PlotShapes( IIf(SAREVENTO2<=1,14,0) ,IIf(SAREVENTO2==0,colorWhite,colorGreen)
, 0, 1, Offset);
PlotShapes( IIf(SAREVENTO2==0,13,0) ,IIf(SAREVENTO2==1,colorWhite,colorRed),
0, 1, Offset*-1);
TimeFrameRestore();
}
Offset=0;
DrawSAR(in1Minute);
DrawSAR(2*in15Minute);
//DrawSAR(2*in5Minute);
//DrawSAR(inHourly);
DrawSAR(inDaily);
DrawSAR(inWeekly);
DrawSAR(inMonthly);
GraphXSpace = 40;
Comments:
ntk
2006-08-06 04:38:19
Interesting! But how would you use this indicator to generate buy/sell order?
ntk
2006-08-06 04:50:09
Interesting! But how would you use this indicator to generate buy/sell order?
W. Tamas wacher [at] freemail.hu 2008-05-11 15:57:09