Hybrid View
-
15-09-2012 06:25 PM #1
Member
- Ngày tham gia
- Oct 2003
- Bài viết
- 365
- Được cám ơn 215 lần trong 148 bài gởi
Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker
Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker
Details:
Formula name: Pivots And Prices And Swing Volume
Author/Uploader: reinsley - (email hidden)
Date/Time added: 2010-04-21 03:54:16
Origin:
Keywords: volume swing pivot
Level: basic
Flags: indicator
Description:
// 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! Group files and
// posted in user's list
// Mod of Pivots And Prices formula
Formula:
// 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, "", colorBlack , 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], 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 );
/*
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 ;
Title = Title + "\n\\c07 " + Minleft + "\\c07 : " + "\\c07 " + Secsleft ;
// Zig-Hi-Zag-Lo formula
VolON = ParamToggle( "Plot Volume", "Off|On", 1 );
ZigON = ParamToggle( "Plot Zig", "Off|On", 1 );
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 );
// Plot the Zig ribbon
Plot ( 1, "", ribboncol, styleArea | styleOwnScale | styleNoLabel, 0, 100 );
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 %", 4, 1, 90, 0.5 );
yshift = Param( "yshift %", 3, 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
) );
}
GraphXSpace = xspace;
-
Những thành viên sau đã cám ơn :
tradingpro8x (12-08-2013)
-
27-08-2013 03:21 PM #2
Gold Member
- Ngày tham gia
- Oct 2009
- Bài viết
- 1,925
- Được cám ơn 617 lần trong 428 bài gởi
Kinh nghiệm phân tích kỹ thuật PTKT chứng khoán bằng MetaStock & AmiBroker
Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

Details:
Formula name: Adaptive Cyber Cycle
Author/Uploader: Robert Dunbar - (email hidden)
Date/Time added: 2012-07-16 08:46:42
Origin: London
Keywords: Adaptive Cyber Cycle, John Ehler
Level: medium
Flags: indicator
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:
You can contact me at "info at coding4ab dot com"
Formula:
//==================================
//==================================
// From John Ehler's book ===
// Rocket Science for Traders ===
// ===
// AFL By Robert Dunbar ===
//==================================
//==================================
Arrows = ParamToggle( "Buy/Sell Arrows", "No|Yes", 1 );
PriceIn = ( ( H + L ) / 2 );
alpha = Param( "Alpha", 0.07, 0.01, 0.4, 0.01, 0.01 );
Len = Param( "Length", 8, 1, 25, 1, 1 );
BullSig = BearSig = Trigger = Cycle = InstPeriod = Period = AdaptCycle =
DeltaPhase = 0;
SmoothX = ( PriceIn + 2 * Ref( PriceIn, -1 ) + 2 * Ref( PriceIn, -2 ) + Ref(
PriceIn, -3 ) ) / 6;
for ( i = 6; i < BarCount; i++ )
Cycle[i] = ( ( 1 - 0.5 * alpha ) ^ 2 ) * ( SmoothX[ i ] - 2 * SmoothX[ i -
1 ] + SmoothX[ i - 2] ) + 2 * ( 1 - alpha ) * Cycle[ i - 1 ] - ( ( 1 - alpha ) ^
2 ) * Cycle[ i - 2 ];
Q1[i] = ( .0962 * cycle[i] + .5769 * cycle[i-2] - .5769 * cycle[i-4] -
.0962 * cycle[i-6] ) * ( .5 + .08 * InstPeriod[i-1] );
I1[i] = cycle[i-3];
if ( Q1[i] != 0 AND Q1[i-1] != 0 )
DeltaPhase[i] = ( I1[i] / Q1[i] - I1[i-1] / Q1[i-1] ) / ( 1 + I1[i] *
I1[i-1] / ( Q1[i] * Q1[i-1] ) );
if ( DeltaPhase[i] < 0.1 )
DeltaPhase[i] = 0.1;
if ( DeltaPhase[i] > 1.1 )
DeltaPhase[i] = 1.1;
//----- Speed up the median calculation by placing it inline
mlen = 5;
for ( k = mlen - 1; k >= 0; k-- )
temparray[k] = DeltaPhase[i + k - ( mlen - 1 )];
}
temp = 0;
for ( k = mlen - 1; k > 0; k-- )
for ( j = mlen - 1; j > 0; j-- )
if ( temparray[j-1] > temparray[j] )
temp = temparray[j-1];
temparray[j-1] = temparray[j];
temparray[j] = temp;
}
}
}
MedianDelta[i] = temparray[mlen - 1 - ( mlen / 2 )];
if ( MedianDelta[i] == 0 )
DC[i] = 15;
else
DC[i] = 6.28318 / MedianDelta[i] + .5;
InstPeriod[i] = .33 * DC[i] + .67 * InstPeriod[i-1];
Period[i] = .15 * InstPeriod[i] + .85 * Period[i-1];
Alpha1[i] = 2 / ( Period[i] + 1 );
AdaptCycle[i] = ( 1 - 0.5 * Alpha1[i] ) * ( 1 - 0.5 * Alpha1[i] ) * (
SmoothX[i] - 2 * SmoothX[i-1] + SmoothX[i-2] ) + 2 * ( 1 - Alpha1[i] ) *
AdaptCycle[i-1] - ( 1 - Alpha1[i] ) * ( 1 - Alpha1[i] ) * AdaptCycle[i-2];
}
Trigger = Ref( AdaptCycle, -1 );
BullSig = IIf( Cross( AdaptCycle, Trigger ), True, False );
BearSig = IIf( Cross( Trigger, AdaptCycle ), True, False );
Plot( AdaptCycle, "AdaptCycle", colorLightBlue );
Plot( Trigger , "Trigger", colorRed );
Plot( 0 , "", colorWhite, styleDashed );
if ( Arrows )
PlotShapes( shapeUpArrow*BullSig, colorBrightGreen );
PlotShapes( shapeDownArrow*BearSig, colorRed );
}
Thông tin của chủ đề
Users Browsing this Thread
Có 1 thành viên đang xem chủ đề này. (0 thành viên và 1 khách vãng lai)
Similar Threads
-
Một bài phân tích hay, có lý và khách quan
By Brainstorm in forum Thảo luận Tình hìnhTrả lời: 0Bài viết cuối: 17-06-2012, 11:41 PM -
Phần mềm phân tích kỹ thuật
By waterloo1815 in forum CLB Chứng khoánTrả lời: 2Bài viết cuối: 28-10-2009, 11:32 PM



Trích dẫn
Bookmarks