Skip to main content

Phi Trade 1.618 - Part 5 dt 15/07/2013 for Amibroker (AFL)

phitrade1.618 almost 13 years ago Amibroker (AFL)

  • Rating:
    4 / 5 (Votes 2)
  • Tags:
    trading system, amibroker

Hi Friend,

Sorry for Late.

please note my simple concept for BUY & Sell signal.

Main Author Amibroker. i’m just little bit correction.

it will be get more benefit.

Just follow buy & sell signal (SAR dot)

thanks for spending your time.

i need commend for each one.

http://phitrade.blogspot.com

Screenshots

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN( "pivot" );
price = ParamToggle( "Plot Price", "Off|On", 1 );
num = Param( "trend", 5, 1, 10, 1 );
dist = 0.5 * ATR( 10 );
rightfig = Param( "rightfig ", 10, 1, 10, 1 );
acc = Param("Acceleration", 0.08, 0, 1, 0.001 );
accm = Param("Max. acceleration", 0.2, 0, 1, 0.001 );
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", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

mHHV = HHV( H, num );
mLLV = LLV( L, num );

FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );

for ( b = Firstvisiblebar + num; b <= Lastvisiblebar AND b < BarCount - num; b++ )
{
    i = num;
    ml = 0;
    mu = 0;

    while ( i > 0 )
    {

        if ( L[b] < L[b+i] )
        {
            ml++;
        }


        if ( H[b] > H[b+i] )
        {
            mu++;
        }

        i--;
    }


    if ( ml == num AND L[B] == mLLV[B] )
    {
        PlotText( "\n *\n", b, L[b], colorGreen );

        if ( price == 1 )
        {
            p = StrRight( NumToStr( L[b], 4.1 ), rightfig );
            PlotText( "\n\n" + p, b - 2 , L[b] , colorGreen );
        }
    }


    if ( mu == num AND H[B] == mHHV[B] )
    {
        PlotText( " *\n", b, H[b], colorRed );

        if ( price == 1 )
        {
            p = StrRight( NumToStr( H[b], 4.1 ), rightfig );
            PlotText( p , b - 2 , H[b] + dist[b] + 1, colorRed );
        }
    }
}

_SECTION_END();

// Vertical Daily Segment 
segments = IIf( Interval() < inDaily, Day(), Month() );
segments = segments != Ref( segments , -1 );
Plot( segments, "", colorDarkBlue, styleHistogram | styleOwnScale | styleDashed | styleNoLabel );
Plot( SAR( acc, accm ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style", styleDots | styleNoLine, maskDefault | styleDots | styleNoLine ) );
/*
Volbar = TimeFrameGetPrice( "V", in1Minute * 20, 0 );
_TRACE( "Volbar = " + Volbar );
*/
// Seconds Remaining

function GetSecondNum()
{
    Time       = Now( 4 );
    Seconds    = int( Time % 100 );
    Minutes    = int( Time / 100 % 100 );
    Hours    = int( Time / 10000 % 100 );
    SecondNum = int( Hours * 60 * 60 + Minutes * 60 + Seconds );
    return SecondNum;
}

RequestTimedRefresh( 1 );
TimeFrame = Interval();
SecNumber = GetSecondNum();
SecsLeft    = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo    = TimeFrame - SecsLeft;

Secsleft = SecsToGo % 60 ;
Minleft = int( SecsToGo / 60 );

//Title = Title +"\n\\c07Min " +  Minleft + "\n\\c05Secs " + Secsleft ;


// Zig-Hi-Zag-Lo formula
VolON = ParamToggle( "Plot Volume", "Off|On", 1 );
ZigON = ParamToggle( "Plot Zig", "Off|On", 0 );
pr = Param( "ZigZag change amount", 0.3, 0.05, 20, 0.05 );

pk = PeakBars( H, pr ) == 0;
tr = TroughBars( L, pr ) == 0;

zzHi = Zig( H, pr );
zzLo = Zig( L, pr );
Avg = ( zzHi + zzLo ) / 2;

x = IIf( pk, zzHi, IIf( tr, zzLo, IIf( Avg > Ref( Avg, -1 ), H, L ) ) );
zzHiLo = Zig( x, pr );

zzup = zzHiLo > Ref( zzHiLo, -1 ) ;
zzdn = zzHiLo < Ref( zzHiLo, -1 );
ribboncol = IIf( zzup , colorWhite, colorBlack );


if ( ZigON == 1 )
    Plot( zzHiLo, "", ribboncol , styleNoLabel );

//Swing Volume
Volswing = Sum( V, BarsSince( zzup != Ref( zzup, -1 ) ) + 1 );
SwingBar = BarsSince( zzHiLo != Ref( zzHiLo, -1 ) );

// plot Volume at 5% from bottom's pane
percent = Param( "PositTextVol%", 5, 2, 90, 0.5 );
xshift = Param( "xshift %", 1, 1, 90, 0.5 );
yshift = Param( "yshift %", 1, 1, 90, 0.5 );
Miny = Status( "axisminy" );
Maxy = Status( "axismaxy" );
y = Miny +  ( Maxy - Miny ) * percent / 100; // at 5 % above bottom of the pane
FirstVisibleBar = Status( "FirstVisibleBar" );
Lastvisiblebar = Status( "LastVisibleBar" );

for ( i = Firstvisiblebar + 1; i <= Lastvisiblebar AND i < BarCount - 1; i++ )
{
    if ( zzup [i] AND zzup [ i+1] == 0 )
    {
        if ( VolON == 1 )
        {
            PlotText( "" + Volswing [ i] , i - xshift , H[i] + yshift , colorWhite );
        }
    }

    if ( zzup [i] == 0 AND zzup [ i+1] == 1 )
    {
        if ( VolON == 1 )
        {
            PlotText( "" + Volswing [ i] , i - xshift , L[i] - yshift , colorBlack );
        }
    }
}

if ( VolON == 1 )
{
    PlotText( "" + Volswing , i + 2  , zzHiLo[BarCount-1], LastValue( ribboncol ) );
} 
_SECTION_BEGIN("Trend");
uptrend=PDI(20)>MDI(10)AND Signal(29)<MACD(13);
downtrend=MDI(10)>PDI(20)AND Signal(29)>MACD(13);


Plot( 2, /* defines the height of the ribbon in percent of pane width */"Phi ribbon",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 0 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );
_SECTION_END();


_SECTION_BEGIN("Name");
GfxSetOverlayMode(0);
GfxSelectFont("Tahoma", Status("pxheight")/8 );
GfxSetTextAlign( 6 );// center alignment
GfxSetTextColor( colorGreen );
GfxSetBkMode(0); // transparent

GfxSelectFont("Tahoma", Status("pxheight")/18 );
GfxTextOut("" , Status("pxwidth")/2, Status("pxheight")/4 );
GfxSelectFont("Tahoma", Status("pxheight")/18 );
GfxSelectFont("Tahoma", Status("pxheight")/36 );
GfxTextOut( "", Status("pxwidth")/2, Status("pxheight")/3 );
_SECTION_END();

//Magfied Market Price
FS=Param("Font Size",40,11,100,1);
GfxSelectFont("Times New Roman", FS, 700, True ); 
GfxSetBkMode(0); // transparent 
GfxSetTextColor( colorGreen );
Hor=Param("Horizonta Position",569,1,1200,1);
Ver=Param("Vertica Position",56,1,830,1); 
GfxTextOut(""+C, Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);

1 comments

1. sukas
almost 13 years ago

Hello
If you advise timeframe for this chart it is most useful.
Also like Volume in higherside like bottom marking possible?
Rgds,
Sukas

Leave Comment

Please login here to leave a comment.