Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

pvt jch for Amibroker (AFL)

Copy & Paste Friendly
#include <T3.AFL>;
Plot(T3(C,10),"T3(10)",colorCustom3,styleThick);
Plot(T3(C,5),"T3(5)",colorCustom3,styleThick);

Buy = Cross (T3(C,10), T3(C,10))AND StrLen(Name())==10;
Sell =  Cross (T3(C,5), T3(C,10))AND StrLen(Name())==10;



_SECTION_END();
_SECTION_END();
_SECTION_END();

 
pr = Param("Elliot Wave minimum % move", 2, 1, 100);
// Beginner Elliot Wave stuff
EWpk = PeakBars(H, pr, 1) == 0;
EWtr = TroughBars(L, pr, 1) == 0;
 
// Intermediate Elliot Wave stuff
zz = Zig(C, pr);
zzHi = Zig(H, pr);
zzLo = Zig(L, pr);
Avg = (zzHi+zzLo)/2;
 
// Advanced Elliot Wave stuff
RetroSuccessSecret = IIf(EWpk, zzHi, IIf(EWtr, zzLo, IIf(Avg > Ref(Avg,-1), H, L)));
EW = Zig(RetroSuccessSecret, pr);
 
// Plot on price chart
/*Plot(C, "Close", colorBlack, styleCandle);*/
Plot(EW, "EW", colorWhite, styleLine);
 
// Plot buy and sell arrows
Buy = TroughBars(EW, pr, 1) == 0;
Sell = PeakBars(EW, pr, 1) ==0;
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBlue,0,L,-15);
PlotShapes(IIf(Buy,shapeSmallCircle,shapeNone),colorWhite,0,BuyPrice,0);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15);
PlotShapes(IIf(Sell,shapeSmallCircle,shapeNone),colorWhite,0,SellPrice,0);
 
AlertIf( Buy , "SOUND C:\\Windows\\Media\\Notify.wav", "Audio alert", 2 );
AlertIf( Sell, "SOUND C:\\Windows\\Media\\Tada.wav", "Audio alert", 2 );
 
_SECTION_BEGIN("Elliot Fractals");
 
/*
The basic definition of an 'up' fractal is a bar high that is both higher than the two bars immediately preceding it
and higher than the two bars immediately following it.
The lows of the bars are NOT considered in determining the up fractal progression.
 
If two bars in the progression have equal highs followed by two consecutive bars with lower highs,
then a total of six bars rather than the usual five bars will make up the progression.
The first High becomes the counting fractal. Reverse for 'down' fractals.
 
The 5 bar formation works best on Daily or longer time frame charts.For intraday data charts we often use 9 bar, 13 bar and 21 bar formations for fractal counting
*/
Up5BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND Ref(H,1) < H AND Ref(H,2) < H;
Up6BarFractal = Ref(H,-2) < H AND Ref(H,-1) < H AND (H == Ref(H,1)) AND Ref(H,2) < H AND Ref(H,3) < H;
Down5BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND Ref(L,1) > L AND Ref(L,2) > L;
Down6BarFractal = Ref(L,-2) > L AND Ref(L,-1) > L AND (L == Ref(L,1)) AND Ref(L,2) > L AND Ref(L,3) > L;
 
//TODO: More filtering: Show only troughs that are around atrough in trix(9).
 
PlotShapes( IIf(Down5BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
PlotShapes( IIf(Down6BarFractal ,shapeSmallUpTriangle,0) ,colorBlack, 0, L,-12);
 
PlotShapes( IIf(Up5BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
PlotShapes( IIf(Up6BarFractal ,shapeSmallDownTriangle,0) ,colorBlack, 0, H,-12);
 
Up = (Up5BarFractal OR Up6BarFractal);
Down = (Down5BarFractal OR Down6BarFractal);
//Removing false fractals:
DownSignal = Flip(Ref(Up,-1), Ref(Down,-1));
UpSignal = Flip(Ref(Down,-1), Ref(Up,-1));
 
LastHigh[0] = H[0];
LastLow[0] = L[0];
 
LastLowIndex = 0;
LastHighIndex = 0;
Valid = 0;
for (i=1; i < BarCount; i++)
{
 
    LastHigh[i] = LastHigh[i-1];
    LastLow[i] = LastLow[i-1];
    if (Up[i])
    {                              
        Valid[i] = True;
        if (DownSignal[i])
        {
            //Sequence of 2 Up Fractals. Validate only the higher one.
            Valid[i] = H[i] >= H[LastHighIndex];
            Valid[LastHighIndex] = H[LastHighIndex] >  H[i];
        }
        LastHigh[i] = Max(H[i], H[LastHighIndex ]);
        LastHighIndex = i; 
    }
 
    if (Down[i])
    {  
        Valid[i] = True;
        if (UpSignal[i])
        {
            //Sequence of 2 Down Fractals. Validate only the lower one.
            Valid[i] = L[i] <= L[LastLowIndex];
            Valid[LastLowIndex] = L[LastLowIndex] <  L[i];
        }
     
        LastLow[i] = Min(L[i], L[LastLowIndex]);
        LastLowIndex = i;      
    }  
}
 
TrixN = Trix(9);
TroughLow = Ref(TrixN, -3) > TrixN AND Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN AND Ref(TrixN, 3) > TrixN;
TroughHigh = Ref(TrixN, -3) < TrixN AND Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN AND Ref(TrixN, 3) < TrixN;
//TroughLow = Ref(TrixN, -2) > TrixN AND Ref(TrixN, -1) > TrixN AND Ref(TrixN, 1) > TrixN AND Ref(TrixN, 2) > TrixN;
//TroughHigh = Ref(TrixN, -2) < TrixN AND Ref(TrixN, -1) < TrixN AND Ref(TrixN, 1) < TrixN AND Ref(TrixN, 2) < TrixN;
ZeroValid = Cross(TrixN, 0) OR Cross(0, TrixN) OR Ref(Cross(TrixN, 0),1) OR Ref(Cross(0, TrixN),1);
ValidLow = TroughLow OR Ref(TroughLow, 1) OR Ref(TroughLow, 2) OR Ref(TroughLow, 3) OR Ref(TroughLow, 4);// OR Ref(TroughLow, 5));
ValidHigh = TroughHigh OR Ref(TroughHigh, 1) OR Ref(TroughHigh, 2) OR Ref(TroughHigh, 3) OR Ref(TroughHigh, 4);// OR Ref(TroughHigh, 5));
 
//Plot(LastHigh-10 ,"LastHigh", colorBlue, styleLine);
//Plot(LastLow-10 ,"LastLow ", colorRed, styleLine);
//Plot(Valid*5 + 10 ,"LastLow ", colorGreen, styleLine | styleThick);
 
//PlotShapes( IIf(Down AND Valid,shapeSmallUpTriangle,0) ,colorGreen, 0, L,-12);
//PlotShapes( IIf(Up AND Valid,shapeSmallDownTriangle,0) ,colorRed, 0, H,-12);
Maxi = Up AND (ValidHigh OR ZeroValid);
Mini = Down AND (ValidLow OR ZeroValid);
PlotShapes( IIf(Down AND (ValidLow OR ZeroValid),shapeSmallUpTriangle,0) ,colorBlue, 0, L,-12);
PlotShapes( IIf(Up AND (ValidHigh OR ZeroValid),shapeSmallDownTriangle,0) ,colorOrange, 0, H,-12);
//Plot(UpSignal*3+5,"UpSignal", colorBlue, styleLine| styleThick);
//Plot(DownSignal*3 ,"DownSignal", colorRed, styleLine| styleThick);
 
/*
LastMaxi = 0;
LastMini = 0;
ElliotLines = 0;
State = 0;
for (i=1; i < BarCount; i++)
{
    State[i] = State[i-1];
    if (Maxi[i])
    {      
        State[i] = 1;//down
    }
 
    if (Mini[i])
    {      
        State[i] = 2;
    }
 
}
 
PlotShapes(IIf(State > 0, shapeSmallCircle, 0), IIf(State == 1, colorRed, colorBlue), 0, IIf(State == 1, H, L), -5);
*/
//Line = LineArray( x0, y0, x1, y1, 1 );
//Plot( Line, "Trend line", colorBlue );
 
/*
Wave B
Usually 50% of Wave A
Should not exceed 75% of Wave A
Wave C
either 1 x Wave A
or 1.62 x Wave A
or 2.62 x Wave A
*/
function CorrectiveRatios(StartPrice, A, B, C, RatioDelta, Delta)
{
     
    ALength = abs(startPrice - A);  BLength = abs(A-B);
    CLength = abs(B-C);
 
    Ratio1 = BLength  / CLength ;
    Cond1 = Ration1 >= 0.5 - RatioDelta AND ratio1 <= 0.75 + RatioDelta;
    Cond2 = abs(Clength - ALength) < Delta  OR abs(Clength - 1.62 * ALength) < Delta OR abs(CLength - 2.62 * ALength) < Delta;
     
    return Cond1 AND Cond2;
}
 
function ImpulseRules(StartPrice, One, Two, Three, Four, Five)
{
    //Wave 2 should be beneath wave 1 start:
    Cond1 = Two > StartPrice AND Two < One;
    //Wave 4 - the same:
    Cond2 = Four > Two AND Four < Three;
    //Wave 5 should be <= wave 3
    Cond3 = abs(Three-Two) >= abs(Five - Four);
    //Wave 1 should be smaller than wave five, making wave 3 the biggest:
    Cond4 = abs(StartPrice - One) < abs(Five - Four);
    return Cond1 AND Cond2 AND Cond3 AND Cond4;
}
_SECTION_END();
_SECTION_END();
_SECTION_END();

_SECTION_END();
_SECTION_END();
_SECTION_END();



 _SECTION_END();

 _SECTION_END();


  _SECTION_END();
 _SECTION_END();
_SECTION_END();
 _SECTION_END();


_SECTION_END();

_SECTION_END();

// Vertical Daily Segment 
segments = IIf( Interval() < inDaily, Day(), Month() );
segments = segments != Ref( segments , -1 );
Plot( segments, "", colorCustom11, styleHistogram | styleOwnScale | styleDashed
| styleNoLabel );



_SECTION_BEGIN("Background");
    SetChartOptions(0,chartShowArrows|chartShowDates);
    SetChartBkColor(ParamColor("Outer panel",colorBlack)); // color of outer border
    SetChartBkGradientFill( ParamColor("Inner panel upper",colorBlack),ParamColor("Inner panel lower",colorBlack));
    tchoice=Param("Title Selection ",2,1,2,1);
_SECTION_END();

 
_SECTION_END();

_SECTION_BEGIN("Magnified Market Price");
//by Vidyasagar, vkunisetty@yahoo.com//
FS=Param("Font Size",20,20,100,1);
GfxSelectFont("Arial", FS, 900, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor( ParamColor("Color",colorYellow) );
//Hor=Param("Horizontal Position",800,800,800,800);
 
Hor=Param("Horizontal Position",50,50,500,20);
 
 
 
 
Ver=Param("Vertical Position",20,20,250,50);
GfxTextOut(""+C,Hor , Ver );
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSelectFont("Arial",1, 200, italic = False, underline = False, True );
GfxSetBkMode( colorWhite );
GfxSetTextColor(ParamColor("Color",colorYellow) );
GfxTextOut(""+DD+" ("+xx+"%)", Hor+5, Ver+33 );
_SECTION_END();

_SECTION_END();

_SECTION_BEGIN("Price Line");


PriceLevel = ParamField("PriceField", field = 3 ); 

Daysback = Param("Bars Back",100,10,500,1); 
FirstBar = BarCount - DaysBack; 
YY = IIf(BarIndex() >= Firstbar,EndValue(PriceLevel),Null); 


side = Param("side",1,0,1000,1);

dist = 0; 

for( i = 0; i < BarCount; i++ ) 
{ 
if(i+side== BarCount) PlotText( "\n " + PriceLevel[ i ], i, YY[ i ]-dist[i], colorCustom11 ); 
} 


_SECTION_END();

_SECTION_END();


// Volume cum
//----------------------------------------------------------
// cumulate the volume for each swing

// by reinsley
// Following the S&C "Price+Volume=Price movement by Tom ORD
// S&C's document is stored in Yahoo! files
// Mod of the Pivots And Prices formula
//----------------------------------------------------------


_SECTION_BEGIN( "Price" );
_N( Title = StrFormat( "{{NAME}} - {{INTERVAL}} {{DATE}} \nOpen %g \nHigh %g
\nLow %g \nClose %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 )
) ) );
Plot( C, "", colorWhite , styleCandle );
_SECTION_END();

_SECTION_BEGIN( "pivot" );
price = ParamToggle( "Plot Price", "Off|On", 1 );
num = Param( "trend", 4, 1, 10, 1 );
dist = 0.5 * ATR( 10 );
rightfig = Param( "rightfig ", 7, 1, 10, 1 );
xspace = Param( "GraphXSpace ", 10, 1, 20, 1 );

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], colorWhite );

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


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

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

_SECTION_END();
_SECTION_END();




_SECTION_END();



Title=EncodeColor(colorWhite)+Date()+"            H="+H+"   L="+L+EncodeColor(colorWhite)+"   C="+C+"  ("+NumToStr((C-Ref(C,-1))/Ref(C,-1)*100,1.2)+" %)    "
;
Back