PDA

View Full Version : Những series bài hay về phần mềm phân tích kỹ thuật AmiBroker



tigeran
11-09-2012, 11:17 AM
Tập hợp những bài viết đỉnh về phần mềm phân tích kỹ thuật AmiBroker

Bạn nào có bài gì hay post lên nhé

:D:D:D:D

tigeran
11-09-2012, 11:18 AM
Đây là loạt bài Amibroker Code về phần mềm phân tích kỹ thuật AmiBroker

Optimization Iteration Reload (OIR) for AmiBroker

One of the (few) notable hardships of using AmiBroker is the inability to view a single optimization iteration result in a backtest or on a chart without having to manually re-enter each of the (who knows how many ...) individual strategy parameters - once thru all of them to setup a backtest, then once thru all of them again to visualize on a chart, and then all of this all over again for every single optimization iteration you want to examine.

CodeForTraders is very pleased to offer our solution to this chore - Optimization Iteration Reload for AmiBroker.

What It Is
Optimization Iteration Reload for AmiBroker is an Excel VBA application, and a process for using it, that allows you to quickly browse optimization results and choose any iteration you wish for quick, "no typing required" reloading into the AA Window parameter set or your chart parameter set.

The only modification needed to your code is the addition of a #include line, which results in the loading of the product output.

How It Works

There are just a few steps involved:

Prep your strategy code by adding the #include line
After your optimization, do a File -> Export of the AA Window results to a .csv file
Open the .csv file in Excel, and highlight the parameters for your chosen iteration
Use Alt-F8 (or your own hotkey) to invoke Optimization Iteration Reload
Return to your chart and use the Parameter Dialog reset button, or
Return to the AA Window, use the Parameter Dialog reset button, and run a backtest
The whole process takes mere seconds.

What It Looks Like

Bim, Bam, Boom - you can now easily browse any iteration of any optimization, choosing it for generation of a complete backtest report with performance graphs - NO TYPING REQUIRED !

Take a look at how it's done:

http://www.screencast.com/t/ajppho5f

1nightdream
11-09-2012, 01:30 PM
Đây là loạt bài Amibroker Code về phần mềm phân tích kỹ thuật AmiBroker

RSI Indicator Suite for AmiBroker

AmiBroker offers incredible flexibility for AFL coders - but where to begin? With so much choice and power available, arriving at a standardized code organization that implements all desired features can be a real challenge.

CodeForTraders is pleased to offer the RSI Indicator Suite for AmiBroker as a low-cost, pre-written, powerful, well-organized place from which to begin (or extend) your AB journey.

What It Is
The RSI Indicator Suite for AmiBroker is 3 AFL formulas which together implement a collection of , visualization, presentation, and optimization techniques to create a complete solution for investigating RSI trading (or trading of any other indicator, after minor editing).

What It Looks Like

Observe the smoothed RSI indicator in the bottom pane. The two brighter horizontal lines (green and red) are your trade entry lines (long and short). The darker horizontal lines are the corresponding exit lines (the colors may be chosen by you).

Notice how the bars in the upper pane have been colored green during long trades, red during short trades, and white when no trades are in progress. Trade entry signal bars are indicated by the green and red arrows. All signals (buy, sell, short, cover) may be seen in the (optional) histogram display at the bottom of the price pane.

These pictures show the extensive set of parameters made available in the main formula (the one in the price pane), which is designed to provide easy control of both interactive visualization, and automatic optimization as desired.
Note the lines that start with "+++++++ ". These indicate blocks of functionality which may be switched on and off as desired for backtests and optimizations.

The lines that end with " ---------- " are individual parameters which may be set to either be optimized or "locked down" from right here in the Parameter Dialog.

Read on to learn about the many other features provided.

Video: RSI Indicator Suite - Visual Introduction

http://www.screencast.com/t/gXa08OMvz0

What It Does

The RSI Indicator Suite Package uses AmiBroker Formula Language (AFL) to implement a long list of desirable features. Each section of code is clearly marked and commented.

Included you will find:

Code for setup of cooperating indicator
Code for adding custom metric(s)
Code for AA window display of non-optimized parameters
Code for optimizer choice and setup
Code for single contract testing
Code for trading on the Open of the next bar after a Signal.
Code for technical calculation(s).
Code for trading long-only, short-only, or in both directions
Code for trading signals in the opposite direction
Code for a choice of trade signal filters
Code for limiting trading to an intraday time window
Code for optimizable indicator-based exits
Code for optimizable StopLoss and PftTgt
Code for determining and displaying exit reason
Code for histogram visualization of buy/sell/short/cover arrays.
Code for passing NetPft to cooperating display indicator in another chart pane.
Code for Displaying signals as an Exploration
Code for on-chart plotting of price, signal arrows, and trade duration/direction bar coloring
Code for creating and displaying informative title text
Code for display of filters

These features are provided in the context of a 4-level, indicator-based trading model:

Low level on the indicator (i.e weakness, oversold) for Long Entry (LE)
High level on the indicator (i.e strength, overbought) for Short Entry (SE)
Long Exit (LX) level on the indicator (for optional indicator-based long trade profit-taking)
Short Exit (SX) level on the indicator (for optional indicator-based short trade profit-taking)

For optimization, there are 8 major numeric dimensions:

RSI_Base_Period
RSI_Smooth_Period
RSI_LowLvl
RSI_HighLvl
RSI_LX_Lvl
RSI_SX_Lvl
StopLossPct
PftTgtPct
along with various other useful switches and choices.

The code uses the RSI as the provided calculation, but has been carefully constructed to allow you to easily substitute a different indicator with only very minor changes to the source.

Video: RSI Indicator Suite - Indicator Trading Model

http://www.screencast.com/t/1LzVBdEzl

Innovations

This strategy has been specially designed to allow wide-scope or narrow-scope optimization to be configured directly from the AB Parameters Dialog. This means optimization across any desired combination of the major numeric dimensions based strictly on Dialog settings without requiring code edits.

Also, custom metrics are used to ensure that non-optimized (i.e. locked-down) major dimensions are displayed in the AmiBroker Automatic window optimization results. This ensures that the report more thoroughly reflects the configuration of parameters used to generate it (which is not normally true by default).



(Note how the "locked down" RSI_Base and RSI_Smooth parameters remain unchanging throughout the optimization, yet are still part of the final display. Without them, you wouldn't know everything important about what created the performance.)

Video: RSI Indicator Suite - Flexible Optimization w/o Code Edits

http://www.screencast.com/t/jUE23rYT

You may choose to operate the code with any of the built-in AmiBroker non-exhaustive optimizers (CMAE, Tribes, SPSO). Again, no code edits required for this!

The goal of this code is to advance the new user past months of study and experimentation directly to feature-rich, working code that is both

immediately useful as-is
easily repurposed and extended
Are you a sophisticated AB user/programmer who has already written similar capabilities for yourself?

If not, CFT believes you will not find a better jump-start anywhere, at any price.

What You Get

The primary RSI-based trading formula for backtesting/optimization/display
Cooperating Net-Profit formula for separate pane display
Cooperating rRSI (remote RSI) formula, for displaying the RSI per the strategy formula settings
A .chart file for creating the window as shown above
Customer Support for initial installation.
This package is distributed as fully-disclosed AFL. You will be able to modify and extend it as desired, but you may not share it with non-licensees (just send them here instead!).

What It Costs
Only $125 for a single, permanent personal-use license. Institutional and multi-person licenses are also available (contact: [email protected]).

How You Get It
Use the 'Add to Cart' button, above left, to purchase the package The package will be emailed to you after your PayPal payment is processed.

Please be aware of the caveats before you order.

1nightdream
11-09-2012, 03:17 PM
Đây là loạt bài Amibroker Code về phần mềm phân tích kỹ thuật AmiBroker

CCI Indicator Suite for AmiBroker

The CCI (Commodity Channel Index) is an indicator with enduring popularity.

CodeForTraders is pleased to offer the CCI Indicator Suite for AmiBroker as a low-cost, pre-written, powerful, well-organized place from which to begin (or extend) your AB journey.

What It Is
The CCI Indicator Suite for AmiBroker is 3 AFL formulas which together implement a collection of , visualization, presentation, and optimization techniques to create a complete solution for investigating CCI trading (or trading of any other indicator, after minor editing).

What It Looks Like

Observe the smoothed CCI indicator in the bottom pane. The two brighter horizontal lines (green and red) are your trade entry lines (long and short). The darker horizontal lines are the corresponding exit lines (the colors may be chosen by you).

Notice how the bars in the upper pane have been colored green during long trades, red during short trades, and white when no trades are in progress. Trade entry signal bars are indicated by the green and red arrows. All signals (buy, sell, short, cover) may be seen in the (optional) histogram display at the bottom of the price pane.


These pictures show the extensive set of parameters made available in the main formula (the one in the price pane), which is designed to provide easy control of both interactive visualization, and automatic optimization as desired.
Note the lines that start with "+++++++ ". These indicate blocks of functionality which may be switched on and off as desired for backtests and optimizations.

The lines that end with " ---------- " are individual parameters which may be set to either be optimized or "locked down" from right here in the Parameter Dialog.

Read on to learn about the many other features provided.

What It Does

The CCI Indicator Suite Package uses AmiBroker Formula Language (AFL) to implement a long list of desirable features. Each section of code is clearly marked and commented.

Included you will find:

Code for setup of cooperating indicator
Code for adding custom metric(s)
Code for AA window display of non-optimized parameters
Code for optimizer choice and setup
Code for single contract testing
Code for trading on the Open of the next bar after a Signal.
Code for technical calculation(s).
Code for trading long-only, short-only, or in both directions
Code for trading signals in the opposite direction
Code for a choice of trade signal filters
Code for limiting trading to an intraday time window
Code for optimizable indicator-based exits
Code for optimizable StopLoss and PftTgt
Code for determining and displaying exit reason
Code for histogram visualization of buy/sell/short/cover arrays.
Code for passing NetPft to cooperating display indicator in another chart pane.
Code for Displaying signals as an Exploration
Code for on-chart plotting of price, signal arrows, and trade duration/direction bar coloring
Code for creating and displaying informative title text
Code for display of filters

These features are provided in the context of a 4-level, indicator-based trading model:

Low level on the indicator (i.e weakness, oversold) for Long Entry (LE)
High level on the indicator (i.e strength, overbought) for Short Entry (SE)
Long Exit (LX) level on the indicator (for optional indicator-based long trade profit-taking)
Short Exit (SX) level on the indicator (for optional indicator-based short trade profit-taking)

For optimization, there are 8 major numeric dimensions:

CCI_Base_Period
CCI_Smooth_Period
CCI_LowLvl
CCI_HighLvl
CCI_LX_Lvl
CCI_SX_Lvl
StopLossPct
PftTgtPct
along with various other useful switches and choices.

The code uses the CCI as the provided calculation, but has been carefully constructed to allow you to easily substitute a different indicator with only very minor changes to the source.

Innovations

This strategy has been specially designed to allow wide-scope or narrow-scope optimization to be configured directly from the AB Parameters Dialog. This means optimization across any desired combination of the major numeric dimensions based strictly on Dialog settings without requiring code edits.

Also, custom metrics are used to ensure that non-optimized (i.e. locked-down) major dimensions are displayed in the AmiBroker Automatic window optimization results. This ensures that the report more thoroughly reflects the configuration of parameters used to generate it (which is not normally true by default).



(Note how the "locked down" CCI_Base and CCI_Smooth parameters remain unchanging throughout the optimization, yet are still part of the final display. Without them, you wouldn't know everything important about what created the performance.)

You may choose to operate the code with any of the built-in AmiBroker non-exhaustive optimizers (CMAE, Tribes, SPSO). Again, no code edits required for this!

The goal of this code is to advance the new user past months of study and experimentation directly to feature-rich, working code that is both

immediately useful as-is
easily repurposed and extended
The CCI Indicator Suite uses the same underlying technology as the RSI Indicator Suite. Please visit that page to view video explanations of the visual features, 4-line indicator trading model, and special optimization features in action.

Though similar to our other Indicator Suite(s), the CCI Indicator Suite is offered separately

for those who prefer CCI as a primary indicator
for those who want to view exactly (with a file comparison tool) how to adapt for a different indicator
for those who want more than one ready-made, without any further edits or typing required
What You Get

The primary CCI-based trading formula for backtesting/optimization/display
Cooperating Net-Profit formula for separate pane display
Cooperating rCCI (remote CCI) formula, for displaying the CCI per the strategy formula settings
A .chart file for creating the window as shown above
Customer Support for initial installation.
This package is distributed as fully-disclosed AFL. You will be able to modify and extend it as desired, but you may not share it with non-licensees (just send them here instead!).

1nightdream
11-09-2012, 05:17 PM
Đây là loạt bài Amibroker Code về phần mềm phân tích kỹ thuật AmiBroker

LRS Strategy Suite for AmiBroker

Linear Regression Slope is an immediately understandable measure of the direction and speed of market motion. The role of fast moves, and the potentially tradable opportunities they create, is a subject appropriate for objective study by every trader.

CodeForTraders is pleased to offer the LRS Strategy Suite for AmiBroker as a low-cost, pre-written, powerful, well-organized place from which to begin (or extend) your AB journey.

What It Is
The LRS Strategy Suite for AmiBroker is 3 AFL formulas which together implement a collection of , visualization, presentation, and optimization techniques to create a complete solution for investigating LRS trading (or trading of any other indicator, after minor editing).

What It Looks Like

Observe the raw/smoothed LRS indicator in the middle pane. In this example, the strategy has been configured to enter long where the 7-period smoothed LRS-3 dips below a threshold value of -.4, and to enter short where the 7-period smoothed LRS-3 rises above a threshold value of 2.9.

You can observe the smoothed line goes yellow when these events take place.



Notice how the bars in the upper pane have been colored green during long trades, red during short trades, and white when no trades are in progress. Trade entry signal bars are indicated by the green and red arrows. All signals (buy, sell, short, cover) may be seen in the (optional) histogram display at the bottom of the price pane.



These pictures show the extensive set of parameters made available in the main formula (the one in the price pane), which is designed to provide easy control of both interactive visualization, and automatic optimization as desired.
Note the lines that start with "+++++++ ". These indicate blocks of functionality which may be switched on and off as desired for backtests and optimizations.

The lines that end with " ---------- " are individual parameters which may be set to either be optimized or "locked down" from right here in the Parameter Dialog.

Read on to learn about the many other features provided.

For insight into the flexibility and convenience of the LRS Suite, please view this RSI Suite video, which introduces the technology in use:

Video: RSI Strategy Suite - Visual Introduction

What It Does

The LRS Strategy Suite Package uses AmiBroker Formula Language (AFL) to implement a long list of desirable features. Each section of code is clearly marked and commented.

Included you will find:

Code for setup of cooperating indicator
Code for adding custom metric(s)
Code for AA window display of non-optimized parameters
Code for optimizer choice and setup
Code for single contract testing
Code for trading on the Open of the next bar after a Signal.
Code for technical calculation(s).
Code for trading long-only, short-only, or in both directions
Code for trading signals in the opposite direction
Code for a choice of trade signal filters
Code for limiting trading to an intraday time window
Code for optimizable indicator-based exits
Code for optimizable StopLoss, ProfitTgt, and TrailingStop
Code for determining and displaying exit reason
Code for histogram visualization of buy/sell/short/cover arrays.
Code for passing NetPft to cooperating display indicator in another chart pane.
Code for Displaying signals as an Exploration
Code for on-chart plotting of price, signal arrows, and trade duration/direction bar coloring
Code for creating and displaying informative title text
Code for display of filters

These features are provided in the context of a 4-level, indicator-based trading model:

Low level on the indicator (i.e weakness, oversold) for Long Entry (LE)
High level on the indicator (i.e strength, overbought) for Short Entry (SE)
Long Exit (LX) level on the indicator (for optional indicator-based long trade profit-taking)
Short Exit (SX) level on the indicator (for optional indicator-based short trade profit-taking)

For optimization, there are 9 major numeric dimensions:

LRS_Base_Period
LRS_Smooth_Period
LRS_LowLvl
LRS_HighLvl
LRS_LX_Lvl
LRS_SX_Lvl
StopLossPct
PftTgtPct
TrailingStopPct
along with various other useful switches and choices.

The code uses the LRS as the provided calculation, but has been carefully constructed to allow you to easily substitute a different indicator with only very minor changes to the source.

For a visual explanation of the features and use of the 4-line indicator trading model, please see this video, originally prepared for the RSI Strategy Suite:

Video: RSI Strategy Suite - Indicator Trading Model

Innovations

This strategy has been specially designed to allow wide-scope or narrow-scope optimization to be configured directly from the AB Parameters Dialog. This means optimization across any desired combination of the major numeric dimensions based strictly on Dialog settings without requiring code edits.

Also, custom metrics are used to ensure that non-optimized (i.e. locked-down) major dimensions are displayed in the AmiBroker Automatic window optimization results. This ensures that the report more thoroughly reflects the configuration of parameters used to generate it (which is not normally true by default).



(Note how the "locked down" LRS_Base and LRS_Smooth parameters remain unchanging throughout the optimization, yet are still part of the final display. Without them, you wouldn't know everything important about what created the performance.)

For a visual explanation of the flexible optimization implementation, please see this video, originally prepared for the RSI Strategy Suite:

Video: RSI Strategy Suite - Flexible Optimization w/o Code Edits

You may choose to operate the code with any of the built-in AmiBroker non-exhaustive optimizers (CMAE, Tribes, SPSO). Again, no code edits required for this!

The goal of this code is to advance the new user past months of study and experimentation directly to feature-rich, working code that is both

immediately useful as-is
easily repurposed and extended
Are you a sophisticated AB user/programmer who has already written similar capabilities for yourself?

If not, CFT believes you will not find a better jump-start anywhere, at any price.

What You Get

The primary LRS-based trading formula for backtesting/optimization/display
Cooperating Net-Profit formula for separate pane display
Cooperating rLRS (remote LRS) formula, for displaying the LRS per the strategy formula settings
A .chart file for creating the window as shown above
Customer Support for initial installation.
This package is distributed as fully-disclosed AFL. You will be able to modify and extend it as desired, but you may not share it with non-licensees (just send them here instead!).

1nightdream
12-09-2012, 08:03 AM
Đây là loạt bài Amibroker Code về phần mềm phân tích kỹ thuật AmiBroker

ZigZag Strategy Suite for AmiBroker

The market Zigs and Zags, and this is a perennial source of fascination for traders. Does movement predict more movement? Should movement be faded? These are fundamental questions of tendency for any market and timeframe which can only be answered by testing.

CodeForTraders is pleased to offer the ZigZag Strategy Suite for AmiBroker as a low-cost, pre-written, powerful, well-organized place from which to begin (or extend) your AB journey.

What It Is
The ZigZag Strategy Suite for AmiBroker is 2 AFL formulas which together implement a collection of , visualization, presentation, and optimization techniques to create a complete solution for investigating ZigZag trading.

What It Looks Like

Observe the price bars with the overlayed ZigZag lines in the page below. In this example, the strategy has been configured to enter with the latest movement of at least 2% in either direction. (Calculations are retrospective for , not intended for real-time trading.)

Notice how the bars have been colored green during long trades and red during short trades (they will be white when no trades are in progress). Trade entry signal bars are indicated by the green and red arrows. All signals (buy, sell, short, cover) may be seen in the (optional) histogram display at the bottom of the price pane.

These pictures show the extensive set of parameters made available in the main formula (the one in the price pane), which is designed to provide easy control of both interactive visualization, and automatic optimization as desired.
Note the lines that start with "+++++++ ". These indicate blocks of functionality which may be switched on and off as desired for backtests and optimizations.

The lines that end with " ---------- " are individual parameters which may be set to either be optimized or "locked down" from right here in the Parameter Dialog.

Read on to learn about the many other features provided.

For insight into the flexibility and convenience of the ZigZag Suite, please view this video, which introduces the technology in use:

Video: ZZ Strategy Suite - Visual Introduction

What It Does

The ZigZag Strategy Suite Package uses AmiBroker Formula Language (AFL) to implement a long list of desirable features. Each section of code is clearly marked and commented.

Included you will find:

Code for adding custom metric(s)
Code for AA window display of non-optimized parameters
Code for optimizer choice and setup
Code for single contract testing
Code for trading on the Open of the next bar after a Signal.
Code for technical calculation(s).
Code for trading long-only, short-only, or in both directions
Code for trading signals in the opposite direction (fade the ZZ)
Code for a choice of trade signal filters
Code for limiting trading to an intraday time window
Code for optimizable StopLoss, ProfitTgt, and TrailingStop
Code for determining and displaying exit reason
Code for histogram visualization of buy/sell/short/cover arrays.
Code for passing NetPft to cooperating display indicator in another chart pane.
Code for Displaying signals as an Exploration
Code for on-chart plotting of price, signal arrows, and trade duration/direction bar coloring
Code for creating and displaying informative title text
Code for display of filters

These features are provided in the context of a Zig-Zag indicator-based trading model:

Trade with new legs of market movement
Trade against new legs of market movement

For optimization, there are 4 major numeric dimensions:

ZigZag_PctChg
StopLossPct
PftTgtPct
TrailingStopPct
along with various other useful switches and choices.

The code uses the ZigZag as the provided calculation and provides built-in display of the relevant pivot points and ZZ legs per your ZigZag_PctChg setting.

Innovations

This strategy has been specially designed to allow wide-scope or narrow-scope optimization to be configured directly from the AB Parameters Dialog. This means optimization across any desired combination of the major numeric dimensions based strictly on Dialog settings without requiring code edits.

Also, custom metrics are used to ensure that non-optimized (i.e. locked-down) major dimensions are displayed in the AmiBroker Automatic window optimization results. This ensures that the report more thoroughly reflects the configuration of parameters used to generate it (which is not normally true by default).

(Note how the "locked down" Mode, Filter, etc. parameters remain unchanging throughout the optimization, yet are still part of the final display. Without them, you wouldn't know everything important about what created the performance.)

For a visual explanation of the flexible optimization implementation, please see this video, originally prepared for the RSI Strategy Suite:

Video: RSI Strategy Suite - Flexible Optimization w/o Code Edits

You may choose to operate the code with any of the built-in AmiBroker non-exhaustive optimizers (CMAE, Tribes, SPSO). Again, no code edits required for this!

The goal of this code is to advance the new user past months of study and experimentation directly to feature-rich, working code that is both

immediately useful as-is
easily repurposed and extended
Are you a sophisticated AB user/programmer who has already written similar capabilities for yourself?

If not, CFT believes our ZigZag Strategy Suite is the most feature-rich, flexible, and easy-to-use code for the study of ZigZags available anywhere.

What You Get

The primary ZigZag-based trading formula for backtesting/optimization/display
Cooperating Net-Profit formula for separate pane display
A .chart file for creating the window as shown above
Customer Support for initial installation.
This package is distributed as fully-disclosed AFL. You will be able to modify and extend it as desired, but you may not share it with non-licensees (just send them here instead!).

tradingpro8x
12-09-2012, 11:35 AM
Đây là loạt bài Simple and Useful Codes về phần mềm phân tích kỹ thuật AmiBroker

Please post in this thread simple codes which enhance default charts.

As a start, attaching afl which marks the values at highs/lows.

Code:
_SECTION_BEGIN("Show Values at H&L");

n=Param("Values back",20,1,200,1);
p=Param("zig %",5,1,100,1);
dist = 0.8*ATR(15);

for( i = 1; i < n; i++ )
**
PlotText(""+LastValue(Peak(H,p,i),True),BarCount-3-LastValue(PeakBars(H,p,i)),LastValue(dist,True)+La stValue(Peak(H,p,i),False),colorblue,ColorRGB(225, 225,225));
PlotText(""+LastValue(Trough(L,p,i),True),BarCount-3-LastValue(TroughBars(L,p,i)),LastValue(Trough(L,p, i),False)-LastValue(dist,True),colorblue,ColorRGB(225,225,22 5));
}

_SECTION_END();


This code could be useful for scalpers, gives the time left in completion of the current bar (in seconds).
Code:
_SECTION_BEGIN("Time Left");
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();
Newperiod = SecNumber % TimeFrame == 0;
SecsLeft = SecNumber - int( SecNumber / TimeFrame ) * TimeFrame;
SecsToGo = TimeFrame - SecsLeft;

x=Param("xposn",918,0,1000,1);
y=Param("yposn",586,0,1000,1);

GfxSelectSolidBrush( ColorRGB( 230, 230, 230 ) );
GfxSelectPen( ColorRGB( 230, 230, 230 ), 2 );
if ( NewPeriod )
**
GfxSelectSolidBrush( colorYellow );
GfxSelectPen( colorYellow, 2 );
Say( "New period" );
}
GfxRoundRect( x+55, y+17, x-4, y-2, 0, 0 );
GfxSetBkMode(1);
GfxSelectFont( "Arial", 9, 700, False );
GfxSetTextColor( colorBlack );
GfxTextOut( ""+SecsToGo+" / "+NumToStr( TimeFrame, 1.0 ), x, y );
_SECTION_END();

tradingpro8x
12-09-2012, 02:03 PM
Đây là loạt bài Simple and Useful Codes về phần mềm phân tích kỹ thuật AmiBroker

Zig-zag function of Metastock in AmiBroker


//This is simply naming the code section
_SECTION_BEGIN("Show Values at H&L");
//asking user to input the maximum no. of bars n on which the values will be plotted
n=Param("Values back",20,1,200,1);
/*Zig is a common function which calculates the hi/lo based on minimum % movement (p)*/
p=Param("zig %",5,1,100,1);
//dist is used for proper plotting of hi/lo values
dist = 0.8*ATR(15);
//looping required in amibroker to plot on all bars which are drawn on chart
for( i = 1; i < n; i++ )
**
/*for plottext function refer here: www.tradinganalysis.co.in/Amibroker_Help/afl/plottext.html */
PlotText(""+LastValue(Peak(H,p,i),True),BarCount-3-LastValue(PeakBars(H,p,i)),LastValue(dist,True)+La stValue(Peak(H,p,i),False),colorblue,ColorRGB(225, 225,225));
PlotText(""+LastValue(Trough(L,p,i),True),BarCount-3-LastValue(TroughBars(L,p,i)),LastValue(Trough(L,p, i),False)-LastValue(dist,True),colorblue,ColorRGB(225,225,22 5));
}

_SECTION_END();

An excel report of the High Low

1. Go to ->automatic and pick afl containing the following code:

Code:
Change= 5;
Filter= C;
AddColumn(Trough(L,Change,1), "Low");
AddColumn(Peak(H,Change,1), "Hi");

Please note 'change' is the minimum % change which the zig function uses to calculate hi/lo
2. Select 'current symbol' and hit 'explore' button. It gives you a table for a particular date and the most recent hi/lo corresponding to that date.

3. To copy result to XL, select all->copy and then paste into a xl sheet

1nightdream
15-09-2012, 06:25 PM
Đâ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;

1nightdream
17-09-2012, 08:23 AM
Đâ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: % B of Bollinger Bands With Adaptive Zones
Author/Uploader: Anthony Faragasso - ajf1111 [at] epix.net
Date/Time added: 2001-12-20 14:22:02
Origin:
Keywords:
Level: basic
Flags: indicator

Formula:

/* %B of Bollinger Bands With Adaptive Zones */
/* Gives Percentage of where the close is in relation to the bands.*/
/* High reading ( Upper band ) , Low reading (Lower band )
/* AFL code by Anthony Faragasso*/

//Inputs
Lookback=60;
Baseline=50;/*Do not Change*/
PerCent=95;
Pds =14;


b=( ( C+2 * StDev( C,20 ) - MA( C,20 ) ) / ( 4 * StDev( C,20 ) ) ) * 100;
/*Input */

Osc=b;

/*Value of Osc*/
Value1 = Osc;

/*Highest AND Lowest Values of Osc during Lookback Period*/
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);

/*Range of Osc during Lookback Period*/
Value4 = Value2 - Value3;

/*Define PerCent of Range to determine OB AND OS levels*/
Value5 = Value4 * (PerCent / 100);

/*Calculate OB AND OS levels*/
Value6 = Value3 + Value5;
Value7 = Value2 - Value5;

baseline=IIf( Osc < 100 ,50 ,IIf( Osc < 0 ,0,0));

Plot(Baseline," Baseline",7,1+4); /* yellow*/
Plot(Value1,"( Adaptive Zones OSC )",6,1+4); /*BLUE*/
Plot(Value6,"O/B",4,1+4); /*RED -TOP(SELL)*/
Plot(Value7,"O/S",5,1+4); /*GREEN-BOT(BUY)*/

Plot(b,"( % B )" ,4,1);

1nightdream
17-09-2012, 04:32 PM
Đâ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: %b indicator - related bollinger bands
Author/Uploader: ajay - (email hidden)
Date/Time added: 2007-03-30 09:10:11
Origin:
Keywords: %b
Level: medium
Flags: indicator

Formula:

Graph0 = (Close - BBandBot (Close, 20, 2))
/ ((BBandTop (Close, 20, 2) - BBandBot (Close, 20, 2)));

Plot( Graph0, "%b indicator", colorBlue );

tigeran
24-09-2012, 06:02 PM
Đâ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: 'R' Channel
Author/Uploader: Mr Valley - (email hidden)
Date/Time added: 2004-02-03 02:15:02
Origin: Author Marc Valley
Keywords: R Channel
Level: advanced
Flags: system,indicator

Description:

/* 'R' Channel */
/*Author Marc Valley */


Var = 4;
M1 = MA(Max(H,Var ),2);
L1 = MA(Min(L,Var ),2);
K = M1 - L1;
Num1 = sqrt(K);
Dem1 = sqrt(1.00+K);
H1 = (Num1/Dem1)/2;
Num2 = sqrt(1.0);
Dem2 = sqrt(1+K);
H2 = ((Num2/Dem2)/2) *C;
H3 =(H1 + H2) ;
MAH2MA =MA(L - (H2/100),Var );
MAH3MA= MA(H + (H3/100) ,Var);
MA3 = (MAH3MA + MAH2MA) /2;
UCL =( MAH3MA + MA3 )/2;
LCL = (MA3 + MAH2MA )/2;

//Buy = INSERT RULES HERE ;
//Sell = INSERT RULES HERE ;
//Cover = Buy;
//Short = Sell;
//Equity(1);

Plot(Close,"Valley 'R' Channel Close",1,8);
//Plot(L,"Low",6,8);
//Plot(Close,"Close",1,64);
Plot(MAH2MA ,"H2",5,4);
Plot(MAH3MA ,"H3",4,4);
Plot(MA3 ,"Center",2,4);
Plot(UCL ,"UCL",10,4);
Plot(LCL ,"LCL",10,4);
//Plot(Avg,"Valley 'R' Channel (C) 2004 Avg",colorYellow,8);


////////////////////////////////// Market Trend Plot Section
//Plot(MA(C,18),"MA18",4,4);
Plot(MA(C,40),"MA40",7,4);
Plot(MA(C,100),"MA100",5,4);
Plot(MA(C,200),"MA200",6,4);
Plot(Close ,"Close" + EncodeColor( colorBlack ) ,2, styleNoLine | styleNoRescale );

Formula:

/* 'R' Channel */
/*Author Marc Valley */


Var = 4;
M1 = MA(Max(H,Var ),2);
L1 = MA(Min(L,Var ),2);
K = M1 - L1;
Num1 = sqrt(K);
Dem1 = sqrt(1.00+K);
H1 = (Num1/Dem1)/2;
Num2 = sqrt(1.0);
Dem2 = sqrt(1+K);
H2 = ((Num2/Dem2)/2) *C;
H3 =(H1 + H2) ;
MAH2MA =MA(L - (H2/100),Var );
MAH3MA= MA(H + (H3/100) ,Var);
MA3 = (MAH3MA + MAH2MA) /2;
UCL =( MAH3MA + MA3 )/2;
LCL = (MA3 + MAH2MA )/2;

//Buy = INSERT RULES HERE ;
//Sell = INSERT RULES HERE ;
//Cover = Buy;
//Short = Sell;
//Equity(1);

Plot(Close,"Valley 'R' Channel Close",1,8);
//Plot(L,"Low",6,8);
//Plot(Close,"Close",1,64);
Plot(MAH2MA ,"H2",5,4);
Plot(MAH3MA ,"H3",4,4);
Plot(MA3 ,"Center",2,4);
Plot(UCL ,"UCL",10,4);
Plot(LCL ,"LCL",10,4);
//Plot(Avg,"Valley 'R' Channel (C) 2004 Avg",colorYellow,8);


////////////////////////////////// Market Trend Plot Section
//Plot(MA(C,18),"MA18",4,4);
Plot(MA(C,40),"MA40",7,4);
Plot(MA(C,100),"MA100",5,4);
Plot(MA(C,200),"MA200",6,4);
Plot(Close ,"Close" + EncodeColor( colorBlack ) ,2, styleNoLine |
styleNoRescale );

tigeran
26-09-2012, 10:39 AM
Đâ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: 10-20 Indicator
Author/Uploader: Dennis Skoblar - DennisAndLisa [at] sbcglobal.net
Date/Time added: 2005-06-14 04:09:34
Origin: Dave Landry On Swing Trading by Dave Landry
Keywords: Dave Landry,Landry,10-20 indicator
Level: basic
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:

Shows how many points the stock has gone in a 20 day (one month) period. The ideal would be for a stock to move 10 points in a 20 day period.

Formula:

_SECTION_BEGIN("TenTwentyValue");
TenTwentyValue = HHV(H,20)-LLV(L,20);
Plot(TenTwentyValue,"10/20 Value",colorRed,styleLine);
_SECTION_END();

1nightdream
29-09-2012, 08:30 AM
Đâ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: 2 Timeframes Candlestick Bar Chart
Author/Uploader: Jorgen Wallgren - (email hidden)
Date/Time added: 2009-07-07 02:27:54
Origin: Got the basic idea from David's (dbwyatt_1999) 2 Timeframe chart code, using the PlotOHLC function with styleCloud, which was shared by him on the AmiBroker List.
Keywords: Timeframe, candlestick
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:

Specially designed for use in day trading AND to save chart space. This chart will displays 2 sets of candlestick bars. One for the time Interval set for your chart- for example 1 Minute. The higher timeframe candlestick bars are created by using gfx Low-level graphics and will display
according to the parameters you set- for example 5 minutes.

Then please observe this AFL code uses the function ColorBlend(ColorFrom, ColorTo, Factor) which was introduced in version 5.21 Beta.
Formula:

_SECTION_BEGIN("2 Timeframes Candlestick Bar Chart");
// Specially designed for use in day trading and to save chart space. This
chart will displays 2 sets
// of candlestick bars. One for the time interval set for your chart- for
example 1 minute.
// The higher timeframe candlestick bars are created by using gfx low-level
graphics and will display
// according to the parameters you set- for example 5 minutes.

// I got the idea from David's (dbwyatt_1999) 2 Timeframe chart code which was
shared by him on the AmiBroker List.
// It uses TimeFrame functions with the PlotOHLC function using styleCloud. So
I was thinking it would look
// very nice using low-level graphics instead. Little bit more complicated, but
I got a few great pointers from Herman!

// If your chart background turns pink- please read the error message in the
upper left corner of the chart.
// Then please observe this AFL code uses ColorBlend(ColorFrom, ColorTo,
Factor) which was introduced in version 5.21 beta.
// The rules are simple- time frames from 1 up to 60 minutes AND Lower time
frame must be smaller than the Higher time frame.

Version(5.21);
SetChartOptions(2, chartShowDates);
Title = Name();
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// PARAMETERS AND SETTINGS:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
ChartLum = Param("Chart Background Color Intensity", 0.40, 0, 1, 0.01);
TFMinShort = Param("Short Timeframe (Minutes)", 1, 1, 60, 1);
TFMinLong = Param("Long Timeframe (Minutes)", 5, 1, 60, 1);
OnSTFBars = ParamToggle("Short TF Bars", "Off, On", 1);
OnLTFBars = ParamToggle("Long TF Bars", "Off, On", 1);
BarLum1 = Param("Short TF Bar Color Intensity", 0, 0, 1, 0.01);
BarLum2 = Param("Long TF Bar Color Intensity", 0.70, 0, 1, 0.01);

SetChartBkColor(ColorBlend(colorLightBlue, colorWhite, ChartLum));
// Bar Colors for the Short Timeframe candlestick bars:
LineColor = ColorBlend(colorBlack, colorWhite, BarLum1);
UpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum1);
DnBarColor = ColorBlend(colorRed, colorWhite, BarLum1);
// Bar Colors For The Long Timeframe candlestick bars:
TFLineColor = ColorBlend(colorBlack, colorWhite, BarLum2 - 0.1);
TFUpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum2);
TFDnBarColor = ColorBlend(colorRed, colorWhite, BarLum2);
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// FUNCTIONS:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
function GetVisibleBarCount()

lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
return Min( Lvb - fvb, BarCount - fvb );
}

function GfxConvertBarToPixelX( bar )

lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxchartleft = Status("pxchartleft");
pxchartwidth = Status("pxchartwidth");
return pxchartleft + bar * pxchartwidth / ( Lvb - fvb + 1 );
}

function GfxConvertValueToPixelY( Value )

local Miny, Maxy, pxchartbottom, pxchartheight;
Miny = Status("axisminy");
Maxy = Status("axismaxy");
pxchartbottom = Status("pxchartbottom");
pxchartheight = Status("pxchartheight");
return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight/ ( Maxy -
Miny ) );
}

StaticVarKey = Name();
procedure xStaticVarSet(SName, SValue)

global StaticVarKey;
if (StaticVarKey != "")
StaticVarSet(Sname + StaticVarKey, Svalue);
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// MAIN PROGRAM:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
if(Interval() != TFMinShort * 60)

Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "Set the chart
time interval to: " + NumToStr(TFMinShort, 1.0, 1) +
" Minute(s) or change the Short Timeframe Parameter setting.";
OnSTFBars = 0;
OnLTFBars = 0;
SetChartBkColor(colorRose);
}

if(TFMinShort >= TFMinLong)

Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "The Long
Timeframe setting must be longer than the Short Timeframe!";
OnSTFBars = 0;
OnLTFBars = 0;
SetChartBkColor(colorRose);
}

if(OnSTFBars)

BarColor = IIf(Close > Open, UpBarColor, DnBarColor);
SetBarFillColor(BarColor);
Plot(Close, "", LineColor, styleCandle);
}
else
Plot(Close, "", colorBlack, styleCandle | styleNoDraw);

TFSec = in1Minute * TFMinLong;
TimeFrameSet(TFSec);
TFOpen = Open;
TFHigh = High;
TFLow = Low;
TFClose = Close;
TFBarIndex = BarIndex();
TFLastBarIndex = LastValue(BarIndex());
TimeFrameRestore();

TFOpen = TimeFrameExpand(TFOpen, TFSec, expandFirst);
TFHigh = TimeFrameExpand(TFHigh, TFSec, expandFirst);
TFLow = TimeFrameExpand(TFLow, TFSec, expandFirst);
TFClose = TimeFrameExpand(TFClose, TFSec, expandFirst);
TFBarIndex = TimeFrameExpand(TFBarIndex, TFSec, expandLast + 1);
TFLastBarIndex = TimeFrameExpand(TFLastBarIndex, TFSec, expandLast + 1);

CandleTop = Max(TFOpen, TFClose);
CandleBottom = Min(TFOpen, TFClose);
//================================================== ==========================
// GFX LOW-LEVEL GRAPHICS SECTION.
// DRAWING THE LONG TIMEFRAME CANDLESTICK BARS:
//================================================== ==========================
if(OnLTFBars)

GfxSetOverlayMode(1);
AllVisibleBars = GetVisibleBarCount();
fvb = Status("firstvisiblebar");
ChartWidth = GfxConvertBarToPixelX(AllVisibleBars );
PixBar = ChartWidth / AllVisibleBars;
Adjust = Pixbar * 0.35;
TFMinutes = TFMinLong / TFMinShort;
NewTFBar = IIf(TFBarIndex != Ref(TFBarIndex, -1), 1, 0);
BarInd = BarIndex();
TFLastBarIndex = LastValue(TFLastBarIndex);

// DRAW BAR HISTORY AND THE CURRENT BAR:
for(i = 0; i < AllVisibleBars; i++)

x1 = GfxConvertBarToPixelX(i) * NewTFBar[i + fvb] - Adjust;
if(BarInd[i + fvb] < TFLastBarIndex AND NewTFBar[i + fvb] == 1)

Counter = 0;
for(n = i + 1; NewTFBar[n + fvb] == 0 AND n + fvb < BarCount-1; n++)
Counter++;
x2 = GfxConvertBarToPixelX(i + Counter) * NewTFBar[i + fvb] + 1 + Adjust;
}

if(TFBarIndex[i + fvb] == TFLastBarIndex)
x2 = GfxConvertBarToPixelX(i + TFMinutes - 1) * NewTFBar[i + fvb] + 1 +
Adjust;

y1 = GfxConvertValueToPixelY(CandleTop[i + fvb]);
y2 = GfxConvertValueToPixelY(CandleBottom[i + fvb]);
yH = GfxConvertValueToPixelY(TFHigh[i + fvb]);
yL = GfxConvertValueToPixelY(TFLow[i + fvb]);

// Candle Body:
GfxSelectPen(TFLineColor, 0);
FillColor = IIf(TFOpen[i + fvb] < TFClose[i + fvb], TFUpBarColor,
TFDnBarColor);
GfxSelectSolidBrush(FillColor);
if(y1 == y2){y1 = y1 - Adjust; y2 = y2 + Adjust;
GfxSelectSolidBrush(TFLineColor);}
if(x1 > 0)
GfxRectangle( x1, y1, x2, y2);
// Candle High and Low:
GfxSelectPen(TFLineColor, 2);
GfxMoveTo(x2+(x1-x2)/2, y1);
GfxLineTo(x2+(x1-x2)/2, yH);
GfxMoveTo(x2+(x1-x2)/2, y2);
GfxLineTo(x2+(x1-x2)/2, yL);
RequestTimedRefresh(0);
}
}
}
_SECTION_END();

tradingpro8x
02-10-2012, 08:11 AM
Đâ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: 3 Price Break
Author/Uploader: Bhcombo -
Date/Time added: 2004-12-05 17:16:00
Origin:
Keywords: Three Price Break
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:

3 Price Break can be used to verify trend and to set trailing stops.

This is a work in progress. I pefer to see the 3PB lines graphed against a candlestick chart versus the traditional 3PB representation. This will graph the price break line as green in an uptrend and red in a down trend. There are parameters for changing the number of price breaks (2 versus 3) and the number of bars to use to begin the study. If you don't see a plot, it is, probably because there are not enough bars to perform the study.

To be corrected - the method used to determine the seed is not correct, but it doesn't matter once the initial trend has been established.
Formula:

Title = Name()+ " Price Break Indicator." ;
//+ " Trend is " + Trend_Text + ". SEQUENCE IS " + Sequence_Text;
Plot(C,Title,colorBlack,styleCandle);

///////// Parameters ////////

nBars_To_Scan = Param("Number of bars to Scan",20, 10,480, 10); //Number of
bars to include in scan
PB_Interval = Param("Number of Bars for Price Break",3,2,3,1);

///////// Use Array of Prices and Price Breaks to Look Back and Determine What
Price Break is For Current Bar
Seedbar = nBars_To_Scan + 1; //Need an initial value to start the PB
process
if (BarCount > Seedbar) //Make sure there are enough bars available to
evaluate


Price[0]= LastValue(Ref(C,-Seedbar)); //Seed the 0 Bar in the Array with
Values
Trend[0]=1; //1 = Long, 0=Short
Sequence[0]=0; //Sequence counter - counts number of new price breaks
Price_Break[0] = LastValue(Ref(C,-Seedbar));
High_C1[0] = LastValue(Ref(C,-Seedbar)); //Highest Close 1 Ago
High_C2[0]= LastValue(Ref(C,-Seedbar)); //Highest Close 2 Ago
High_C3[0]= LastValue(Ref(C,-Seedbar)); //Highest Close 3 Ago
Low_C1[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 1 Ago
Low_C2[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 2 Ago
Low_C3[0] = LastValue(Ref(C,-Seedbar)); //Lowest Close 3 Ago

for ( i=1; i < Seedbar ; i++) //Cycle through prices filling in price array
and caculating price breaks

Prior = i-1; //Index for Prior entry in array. Set the current array
values to
Trend[i]=Trend[Prior]; //prior values to make sure everything that isn't
changed later
Price_Break[i] = Price_Break[Prior]; //gets carried forward to the next row
in the array.
Low_C1[i] = Low_C1[Prior]; //Carryover current values
Low_C2[i] = Low_C2[Prior];
Low_C3[i] = Low_C3[Prior];
High_C1[i] = High_C1[Prior]; //Carryover current values
High_C2[i] = High_C2[Prior];
High_C3[i] = High_C3[Prior];
Sequence[i] = Sequence[Prior];

Price[i] = LastValue (Ref (C,-(Seedbar-i))); //Seedbar is the bar just in
front of where I start the method. Works since i starts at 1

if (Price[i] >Price[Prior] AND Trend[Prior] == 1 ) // If Close is Greater than
the prior close And the Trend is Long
if (Price[i] >High_C1[Prior]) //If the Close is greater than the last
highest close
//Test For Price Break. The IIF is there to accomodate a 2 price
or 3 price break option
//based on the PB_Interval parameter
Price_Break[i] = IIf(PB_Interval == 3,High_C3[Prior],IIf(PB_Interval ==
2,High_C2[Prior],High_C3[Prior]));
//The 3PB method says I take the highest close 4 ago as the new
price break.
Sequence[i] = Sequence[i] + 1; //Increment Sequence if Price Break
High_C3[i] = High_C2[Prior]; //Stacking the higher closes like this avoids
having to go back and iterate through the.
High_C2[i] = High_C1[Prior]; //closes to find and count the higher closes.
They are just carried forward in the stack.
High_C1[i] = Price[i]; //When a higher close occurs, it is put on the top
of the stack, each close below is
} //pushed down in sequence, and the earliest (farthest back) close
goes away.
}

if (Price[i] >Price[Prior] AND Trend[Prior] == 0 ) // If Close is Greater than
the prior close And the Trend is Short
if (Price[i] >Price_Break[Prior]) //If Close > Price Break in trend is
Short, Reverse and go Long

High_C1[i] = High_C2[i] = High_C3[i] = Price[i]; //Initialize sequence of
new Highs
Price_Break[i] = Price[i]; //Set new value for Price Break
Trend[i] = 1; //Set the trend Long
Sequence = 0;
}
}

if (Price[i] <Price[Prior] AND Trend[Prior] ==0) // If The Close is less than
the prior close And the Trend is Short
if (Price[i] <Low_C1[Prior]) //If the Close is less than the last lowest
close

Price_Break[i] = IIf(PB_Interval == 3,Low_C3[Prior],IIf(PB_Interval ==
2,Low_C2[Prior],Low_C3[Prior])); //Test For Price Break
Sequence[i] = Sequence[i] + 1; //Increment Sequence if Price Break
Low_C3[i] = Low_C2[Prior]; //Update sequence of new Lows
Low_C2[i] = Low_C1[Prior];
Low_C1[i] = Price [i];
}
}

if (Price[i] <Price[Prior] AND Trend[Prior] ==1) // If The Close is less than
the prior close And the Trend is Long
if (Price[i] < Price_Break[Prior]) //If Close < Price Break in Long
Trend, reverse and go Short

Low_C1[i] = Low_C2[i] = Low_C3[i] = Price[i]; //Initialize sequence of new
Lows
Price_Break[i] = Price[i]; //Set new value for Price Break
Trend[i] = 0; //Set Trend Short
Sequence = 0;
}
}

//// Plot the Price Breaks.
Bar_x1=BarCount - (nBars_To_Scan - Prior );
Bar_x2=BarCount - ( nBars_To_Scan - i);
PB_Color = IIf(Trend[i] == 1,colorGreen, colorRed);
Plot(LineArray(Bar_x1,Price_Break[i],Bar_x2,Price_Break[i],extend=0),"",PB_Color,styleThick);
Sequence_Text = NumToStr(Sequence,format=1.0);
Trend_Text = WriteIf(Trend[i] > 0, "Long","Short");

} //Close the For Loop

} //Close the first test for sufficient bars to do the study

1nightdream
13-10-2012, 02:49 PM
Đâ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: 30 Week Hi Indicator - Calculate
Author/Uploader: Geoff Mulhall - geoffmulhall [at] optusnet.com.au
Date/Time added: 2003-05-03 22:12:35
Origin:
Keywords: 30 Week High
Level: semi-advanced
Flags: exploration,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:

Just as the advance decline line gives an indication of the overall strength of the market, so does the number or stocks makeing new 30 week high's. Refer Weinstein's "The Secret of Profiting in Bull and Bear Markets".

The attached scan ( _s.afl file) calculates two indices. The first index calculates the number of stocks making new 30 week highs based on the high of each stock. The second index calculates the number of stocks making new 30 week high's - but calculated from the weekly close of each stock. You'll find there is little difference between the two.

The scan must be run first as it uses the AddToComposite function to create the two indices. It must be run over an entire market.

The indicator can then be plotted. Note that the scan is run against weekly data and therefore it only makes sense to display the results on a weekly chart.



Formula:

/* Calculate indices of new 30 week high's vs new 30 week lows */
/* Set the filter so as to scan a given market */
/* Set Period to Weekly */
/* The new indexes will be found in Group 253 */

H1 = Close > Ref(HHV(Close,30),-1);
H2 = High > Ref(HHV(High,30),-1);

L1 = Close < Ref(LLV(Close,30),-1);
L2 = Low < Ref(LLV(Low,30),-1);

H_L_Array1 = H1 - L1;
H_L_Array2 = H2 - L2;

// Do not generate signals

Buy = 0;
Filter = 0;

AddToComposite( H_L_Array1, "~Idx30Wk_Close_HL", "X", 19);
AddToComposite( H_L_Array2, "~Idx30Wk_Abs_HL", "X", 19);

tradingpro8x
19-10-2012, 07:56 AM
Đâ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: 30 Week Hi Indicator - Display
Author/Uploader: Geoff Mulhall - geoffmulhall [at] optusnet.com.au
Date/Time added: 2003-05-03 22:17:05
Origin:
Keywords:
Level: semi-advanced
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:

Refer 30 Week High Indicator - Calculate

The attached indicator builder afl ( _i.afl file ) plots the indicator calculated by the ( _s.afl file ).

Formula:

// 300 Week Highs Indicator
// Set Scaling to automatic
// Set Gridlines - Level 0, Show dates, Middle
// Plot on a weekly chart only

GraphXSpace = 10;

Plot(Foreign("~Idx30Wk_Close_HL","C",1),"Close_HL",colorRed,styleLine);
Plot(Foreign("~Idx30Wk_Abs_HL","C",1),"Abs_HL",colorBlue,styleLine);

longcathay
08-08-2013, 03:26 PM
Kể bằng tiếng việt thì tốt .

tigeran
10-08-2013, 09:32 AM
Cá nhân mình thì thích đọc phân tích kỹ thuật cũng như phân tích cơ bản bằng tiếng anh hơn là bản dịch vì khi dịch ra tiếng việt nó mất đi một phần ý nghĩa :lee::lee::lee::lee:

tradingpro8x
12-08-2013, 10:39 AM
Gửi anh em chỉ báo phân tích kỹ thuật trong AmiBroker khá hay

Details:

Formula name: 3TF Candlestick Bar Chart

Author/Uploader: Jorgen Wallgren - jorgen.wallgren [at] gmail.com
Date/Time added: 2010-09-19 21:12:01
Origin: Got the basic idea from David's (dbwyatt_1999) 2 Timeframe chart code, using the PlotOHLC function with styleCloud, which was shared by him on the AmiBroker List.
Keywords: Timeframe, candlestick
Level: semi-advanced
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:

Specially designed for use in day trading AND to save chart space. This chart will display 3 sets of candlestick bars. One for the time Interval set for your chart- for example 1 Minute. The higher timeframe candlestick bars are created by using gfx Low-level graphics and will display
according to the parameters you set- for example 5 and 15 minutes. This code can be very much improved and made faster, but I provide it as it is.

Formula:

_SECTION_BEGIN("3 TF Candlestick Bar Chart");
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
// 3 TIMEFRAMES CANDLESTICK CHART
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXX
Version(5.21);
SetChartOptions(2, chartShowDates);
Title = Name();
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// PARAMETERS AND SETTINGS:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
ChartLum = Param("Chart Background Color Intensity", 0, 0, 1, 0.01);
TFMinShort = Param("Short Timeframe (Minutes)", 1, 1, 60, 1);
TFMinMedium = Param("Medium Timeframe (Minutes)", 5, 1, 60, 1);
TFMinLong = Param("Long Timeframe (Minutes)", 15, 1, 60, 1);
OnSTFBars = ParamToggle("Short TF Bars", "Off, On", 1);
OnMTFBars = ParamToggle("Medium TF Bars", "Off, On", 1);
OnLTFBars = ParamToggle("Long TF Bars", "Off, On", 1);
BarLum1 = Param("Short TF Bar Color Intensity", 0, 0, 1, 0.01);
BarLum2 = Param("Medium TF Bar Color Intensity", 0.70, 0, 1, 0.01);
LTFLine = Param("Long TF Bar Line Thickness", 3, 0, 10, 1);
BarLum3 = Param("Long TF Bar Color Intensity", 0.50, 0, 1, 0.01);

// Bar Colors for the Short Timeframe candlestick bars:
LineColor = ColorBlend(colorBlack, colorWhite, BarLum1);
UpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum1);
DnBarColor = ColorBlend(colorRed, colorWhite, BarLum1);

SetChartBkColor(ColorBlend(colorLightBlue, colorWhite, ChartLum));
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// FUNCTIONS:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
function GetVisibleBarCount()

lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
return Min( Lvb - fvb, BarCount - fvb );
}

function GfxConvertBarToPixelX( bar )

lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxchartleft = Status("pxchartleft");
pxchartwidth = Status("pxchartwidth");
return pxchartleft + bar * pxchartwidth / ( Lvb - fvb + 1 );
}

function GfxConvertValueToPixelY( Value )

local Miny, Maxy, pxchartbottom, pxchartheight;
Miny = Status("axisminy");
Maxy = Status("axismaxy");
pxchartbottom = Status("pxchartbottom");
pxchartheight = Status("pxchartheight");
return pxchartbottom - floor( 0.5 + ( Value - Miny ) * pxchartheight/ ( Maxy -
Miny ) );
}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
// MAIN PROGRAM:
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXX
if(Interval() != TFMinShort * 60)

Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "Set the chart
time interval to: " + NumToStr(TFMinShort, 1.0, 1) +
" Minute(s) or change the Short Timeframe Parameter setting.";
OnSTFBars = 0;
OnMTFBars = 0;
OnLTFBars = 0;
SetChartBkColor(colorRose);
}

if(TFMinShort >= TFMinLong)

Title = Title + "\n" + "\n" + "ALERT, ALERT, ALERT!!!" + "\n" + "The Long
Timeframe setting must be longer than the Short Timeframe!";
OnSTFBars = 0;
OnLTFBars = 0;
OnLTFBars = 0;
SetChartBkColor(colorRose);
}

if(OnSTFBars)

BarColor = IIf(Close > Open, UpBarColor, DnBarColor);
SetBarFillColor(BarColor);
Plot(Close, "", LineColor, styleCandle);
}
else
Plot(Close, "", colorBlack, styleCandle | styleNoDraw);

function PlotBars(TFMinLong, BarLum, Style)


// Bar Colors For The Medium and Long Timeframe candlestick bars:
TFLineColor = ColorBlend(colorBlack, colorWhite, BarLum - 0.1);
TFUpBarColor = ColorBlend(colorBrightGreen, colorWhite, BarLum);
TFDnBarColor = ColorBlend(colorRed, colorWhite, BarLum);

TFSec = in1Minute * TFMinLong;
TimeFrameSet(TFSec);
TFOpen = Open;
TFHigh = High;
TFLow = Low;
TFClose = Close;
TFBarIndex = BarIndex();
TFLastBarIndex = LastValue(BarIndex());
TimeFrameRestore();

TFOpen = TimeFrameExpand(TFOpen, TFSec, expandFirst);
TFHigh = TimeFrameExpand(TFHigh, TFSec, expandFirst);
TFLow = TimeFrameExpand(TFLow, TFSec, expandFirst);
TFClose = TimeFrameExpand(TFClose, TFSec, expandFirst);
TFBarIndex = TimeFrameExpand(TFBarIndex, TFSec, expandLast + 1);
TFLastBarIndex = TimeFrameExpand(TFLastBarIndex, TFSec, expandLast + 1);

CandleTop = Max(TFOpen, TFClose);
CandleBottom = Min(TFOpen, TFClose);
//================================================== ==========================
// GFX LOW-LEVEL GRAPHICS SECTION.
// DRAWING THE LONG TIMEFRAME CANDLESTICK BARS:
//================================================== ==========================
GfxSetOverlayMode(1);
AllVisibleBars = GetVisibleBarCount();
fvb = Status("firstvisiblebar");
ChartWidth = GfxConvertBarToPixelX(AllVisibleBars );
PixBar = ChartWidth / AllVisibleBars;
Adjust = Pixbar * 0.35;
TFMinutes = TFMinLong / TFMinShort;
NewTFBar = IIf(TFBarIndex != Ref(TFBarIndex, -1), 1, 0);
BarInd = BarIndex();
TFLastBarIndex = LastValue(TFLastBarIndex);

// DRAW BAR HISTORY AND THE CURRENT BAR:
for(i = 0; i < AllVisibleBars; i++)

x1 = GfxConvertBarToPixelX(i) * NewTFBar[i + fvb] - Adjust;
if(BarInd[i + fvb] < TFLastBarIndex AND NewTFBar[i + fvb] == 1)

Counter = 0;
for(n = i + 1; NewTFBar[n + fvb] == 0 AND n + fvb < BarCount-1; n++)
Counter++;
x2 = GfxConvertBarToPixelX(i + Counter) * NewTFBar[i + fvb] + 1 + Adjust;
}

if(TFBarIndex[i + fvb] == TFLastBarIndex)
x2 = GfxConvertBarToPixelX(i + TFMinutes - 1) * NewTFBar[i + fvb] + 1 +
Adjust;

y1 = GfxConvertValueToPixelY(CandleTop[i + fvb]);
y2 = GfxConvertValueToPixelY(CandleBottom[i + fvb]);
yH = GfxConvertValueToPixelY(TFHigh[i + fvb]);
yL = GfxConvertValueToPixelY(TFLow[i + fvb]);

// Candle Body:
FillColor = IIf(TFOpen[i + fvb] < TFClose[i + fvb], TFUpBarColor,
TFDnBarColor);
if(Style == "Fill")

GfxSelectPen(TFLineColor, 1);
GfxSelectSolidBrush(FillColor);
}
else

GfxSelectPen(FillColor, LTFLine);
GfxSelectSolidBrush(ColorBlend(colorLightBlue, colorWhite, ChartLum));
}

if(y1 == y2){y1 = y1 - Adjust; y2 = y2 + Adjust;
GfxSelectSolidBrush(TFLineColor);}
if(x1 > 0)
GfxRectangle( x1, y1, x2, y2);

// Candle High and Low:
GfxSelectPen(TFLineColor, 2);
GfxMoveTo(x2+(x1-x2)/2, y1);
GfxLineTo(x2+(x1-x2)/2, yH);
GfxMoveTo(x2+(x1-x2)/2, y2);
GfxLineTo(x2+(x1-x2)/2, yL);
RequestTimedRefresh(0);
}
}
}

if(OnLTFBars)
PlotBars(TFMinLong, BarLum3, "Line");
if(OnMTFBars)
PlotBars(TFMinMedium, BarLum2, "Fill");
_SECTION_END();

tradingpro8x
12-08-2013, 11:48 AM
Đâ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: 4% Model - Determine Stock Market Direction

Author/Uploader: MTR Investors Group - (email hidden)
Date/Time added: 2009-06-20 02:46:18
Origin: 4% Model discovered by Ned Davis. Used to determine the direction of the stock market. Only works on the Value Line Arithmetic Index. Yahoo! Symbol ^VAY. Enhanced Model at www.MTRIG.com updated daily
Keywords: 4% Model, Ned Davis, Martin Zweig, 4 Percent Model
Level: medium
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:

Model discovered by Ned Davis. This is used to determine the direction of the stock Market. Once you know the direction the go LONG/SHORT an index ETF or your
Favorite stock. This model was made know by Martin Zweig in his book Winning on Wall Street.

Formula:

/*-------------------------------------------------------------------------------------
MTR Investors Group - www.MTRIG.com

System: 4% Model discovered by Ned Davis. This is used to determine the
direction of the
stock Market. Once you know the direction the go LONG/SHORT an index ETF or
your
Favorite stock. This model was made know by Martin Zweig in his book
Winning on Wall Street.

NOTE: This formula is the classic model. To see daily automated results of an
enhanced version
of this formula stop by www.MTRIG.com.

How To Use:
1. This system works ONLY with the Value Line Arithmetic Index. In Yahoo! the
symbol is ^VAY. Try to run it on the NASDAQ, SP500, or the DOW the results are
poor.
2. Overlay the system to see BUY/SELL indicators on a ^VAY chart.
3. Run a back-test on the ^VAY symbol to test the results.

---------------------------------
Returns: 1/1/1998 to 6/20/2009
Net Risk Adjusted Return: 408.01%
Winners: 45.57%
---------------------------------

-------------------------------------------------------------------------------------*/
//VC = The Close of the Value Line Arithmetic Index
VC = Foreign("^VAY", "Close");

//Compute the percent change of the VAY week over week.
PCTChange = ((VC - Ref(VC,-5 ) ) / Ref(VC,-5 ) ) * 100;

//Look for 4% changes this week compared to last week.
PCT_B = 4;
PCT_S = 4;
PCT_S = PCT_S * -1;

// BUYS And SELLS
xBuy = PCTChange >= PCT_B;
xSell = PCTChange <= PCT_S;

PlotBuy = ExRem(xBuy ,xSell);
PlotSell = ExRem(xSell ,xBuy );

Buy = (PlotBuy);
Sell = (PlotSell );

Short=Sell;
Cover=Buy;

PlotShapes(shapeUpArrow * PlotBuy , colorGreen, 0,L);
PlotShapes(shapeDownArrow * PlotSell , colorRed, 0,H);

tradingpro8x
12-08-2013, 02:58 PM
Đâ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: 52 Week New High-New Low Index

Author/Uploader: Dennis Skoblar - DennisAndLisa [at] sbcglobal.net
Date/Time added: 2005-07-11 10:14:58
Origin: Alexander Elder's book, "Trading For A Living"
Keywords: New Hi-New Low Index, 52 Week New Hi-New Low Index
Level: basic
Flags: exploration,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:

Calculates new 52 week High's vs new 52 week lows. Input a Date 5 years back to the current Date in the Range section of the Window AND click the From button. In the Apply To section, click the Use Filter button AND click the Define > Include > Group > Stock to scan stocks ONLY. Right click on chart window,
then > Parameters > Show MiddlLe Lines - NO > Levels > +-100. Compare against the SP-500, look for convergences, divergences. Read Elder's book "Trading For A Living" pp.194-200. The new symbol "~NewHiNewLoIndex" will be found in the Workspace > Symbol > All > at the end.

Formula:

// Calculates new 52 week High's vs new 52 week lows.
// The new symbol "~NewHiNewLoIndex" will be found in the Workspace > Symbol >
All > at the end.
// Input a Date 5 years back to the current Date in the Range section of the
Window AND click the From button.
// In the Apply To section, click the Use Filter button AND click the Define >
Include > Group > Stock
// to scan stocks ONLY. Right click on chart window, then > Parameters > Show
MiddlLe Lines - NO > Levels > +-100.
// Compare against the SP-500, look for convergences, divergences. Read Elder's
book "Trading For A Living" pp.194-200.

H1 = High > Ref(HHV(High,260),-1);
L1 = Low < Ref(LLV(Low,260),-1);
HiLoDifference = H1 - L1;

Buy = 0;
Filter = 0;

AddToComposite( HiLoDifference , "~NewHiNewLoIndex", "X", atcFlagDefaults =
7);

GraphXSpace = 10;
Plot(Foreign("~NewHiNewLoIndex","C",1),"52 Week New High - New Low
Index",colorYellow,styleHistogram);

tradingpro8x
12-08-2013, 03:01 PM
Đâ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: Absolute Breadth Index

Author/Uploader: Tomasz Janeczko - tj --at-- amibroker.com
Date/Time added: 2001-06-16 07:36:16
Origin: Originaly developed by Norman G. Fosback.
Keywords: breadth
Level: basic
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:

The Absolute Breadth Index (ABI) is a market momentum indicator that was developed by Norman G. Fosback. The ABI shows how much activity, volatility, and change is taking place on the New York Stock Exchange while ignoring the direction prices are headed. You can think of the ABI as an "activity index". High readings indicate market activity and change, while low readings indicate lack of change. In Mr. Fosback's book, Stock Market Logic, he indicates that historically, high values typically lead to higher prices three to twelve months later.

Formula:

/*
Absolute Breadth Index
AFL implementation by Tomasz Janeczko.

*/

graph0 = abs( AdvIssues() - DecIssues() );

tradingpro8x
12-08-2013, 03:25 PM
Đâ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: AC+ acceleration
Author/Uploader: Steve Wiser - slwiserr [at] erols.com
Date/Time added: 2001-07-05 19:08:13
Origin:
Keywords:
Level: semi-advanced
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:

Supports William's Alligator Trend Following system

Formula:

/* Exploration, System and Indicator */
Author: Steve Wiser
Email address: [email protected]
May 5, 2001 */

outsidebar = outside();
insidebar = H <= Ref(H,-1) and L >= Ref(L,-1);
upbar = H > ref(H,-1) and L >= ref(L, -1);
downbar = L < ref(L,-1) and H <= ref(H,-1);
barcolor=iif(outsidebar, 1,
iif(downbar, 4,
iif(upbar, 5,
iif(insidebar,6, 0 ) ) ) );

var1=ma( A , 34);
var2=ma( A,5);
var3=var2-var1;
var4=var3-ma(var3,5);
Graph0=var4;
graph0style=2+4;
Graph1=wilders(var4,5);
Graph1Style=5;
Graph0Barcolor=Barcolor;

tradingpro8x
12-08-2013, 03:31 PM
Đâ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: accum/dist mov avg crossover SAR
Author/Uploader: Jeff Parent - (email hidden)
Date/Time added: 2002-07-31 16:21:24
Origin:
Keywords: accumulation distribution volume SAR
Level: semi-advanced
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:

Similar to a volume weighted price support/resistance line, uses the accumulation / distribution indicator to set stop line. vbscript required to calculate variable lookback period.

Formula:

EnableScript("vbscript");
<%
function jMA(jH,jL,A2,A2m,k)
dim result()
redim result(UBound(jH))

for i=k to UBound(jH)
n=i+1
if A2(i)<= A2m(i) then
do until n=0
n=n-1
if A2(n)>= A2m(i) then exit do
Loop
result(i)=jH(n)
else
do until n=0
n=n-1
if A2(n)<= A2m(i) then exit do
Loop
result(i)=jL(n)
end if
next
jMA=result
end function
%>

script=GetScriptObject();

n=60;
Graph0=script.jMA(H,L,AccDist(),EMA(AccDist(),n),n );

Graph1=C;
Graph1Style=128;
Graph2=IIf(C<MA(C,n),MA(H,n),MA(L,n));Graph2Style=1;

tradingpro8x
12-08-2013, 03:34 PM
Đâ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: AccuTrack

Author/Uploader: Salil V Gangal - salil_gangal [at] yahoo.com
Date/Time added: 2003-09-12 12:50:01
Origin: FastTrack
Keywords: AccuTrack
Level: basic
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:

// AccuTrack Compares performance of two securities
// The basic idea is to switch between the two securities
// AccuTrack was developed by FastTrack (fasttrack.net)
Formula:

// AccuTrack Compares performance of two securities
// The basic idea is to switch between the two securities
// AccuTrack was developed by FastTrack (http://fasttrack.net)

// Following is the Indicator Builder Formula

fnd = Name();
ind = "FDRXX"; // FDRXX is money market fund, so the comparison is done
with cash.
fund = Foreign(fnd, "Close");
index = Foreign(ind, "Close");

fast = 6;
slow = 24;
RawAT = EMA((EMA(ROC(fund,1), slow) - EMA(ROC(index,1),slow)),fast);
tradeAccuTrack = RawAT * 265;
Plot(tradeAccuTrack, "tradeAccuTrack", colorBlue, styleLine);

Title = Date()
+ " Trade AccuTrack of "
+ fnd
+" / "
+ ind
+ " = " + WriteVal(tradeAccuTrack, 1.2) + " ";

GraphXSpace = 2;

tradingpro8x
12-08-2013, 03:37 PM
Đâ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: Adaptave Zones O/B & O/S Oscillator
Author/Uploader: Anthony Faragasso - ajf1111 [at] epix.net
Date/Time added: 2001-12-27 10:22:54
Origin:
Keywords:
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:

Automatically Adjusts the Overbought and Oversold levels based on past performance.( Lookback ).
Set up to be used with AmiBroker PrePackaged indicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE,ROC,
Also, Added RSI of MACD indicator.
User Friendly, Set with Vairable Identifiers and information in the title as to what indicator is being studied.

A1=RSIt; B2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);
F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);

Osc=C3; /*insert variable by Identifier*/

Further Improvements will be Added to Enhance.

Formula:

/*Adaptive Zones OB/OS OSCILLATOR*/
/*Automatically Adjusts the overbought and oversold levels based on past
performance*/
/*Interpreted and coded by Anthony Faragasso*/
/*Can be used with PrePackaged
indicators,RSI,CCI,STOCHK,STOCHD,MFI,ULTIMATE,*/
/*For ROC add the Close. ex.ROC(C,pds);*/

MaxGraph=10;
/*Input */
Lookback=60;
PerCent=95;
Pds =14;

/****Dimitri Code***********/
/*14-Day RSI of MACD()*/
//t=14; Replaced with pds= statement
Var=MACD();
Up=IIf(Var>Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Dn=IIf(Var<Ref(Var,-1),abs(Var-Ref(Var,-1)),0);
Ut=Wilders(Up,Pds);
Dt=Wilders(Dn,Pds);
RSIt=100*(Ut/(Ut+Dt));
/************End Code*************************/

/*******Variables******************/

A1=RSIt; B2=RSI(pds); C3=CCI(pds); D4=StochK(pds); E5=StochD(pds);
F6=MFI(pds); G7=Ultimate(pds); H8=ROC(C,pds);


Osc=C3; /*insert variable by Identifier*/

/*Value of Osc*/
Value1 = Osc;

/*Highest AND Lowest Values of Osc during Lookback Period*/
Value2 = HHV(Value1,Lookback);
Value3 = LLV(Value1,Lookback);

/*Range of Osc during Lookback Period*/
Value4 = Value2 - Value3;

/*Define PerCent of Range to determine OB AND OS levels*/
Value5 = Value4 * (PerCent / 100);

/*Calculate OB AND OS levels*/
Value6 = Value3 + Value5;
Value7 = Value2 - Value5;

baseline=IIf( Osc < 100 AND Osc > 10 ,50 ,IIf( Osc < 0 ,0,0));

Header=WriteIf(Osc==A1," RSI Of MACD",WriteIf(Osc==b2," RSI",WriteIf(Osc==C3,"
CCI",WriteIf(Osc==D4,"STOCHK",WriteIf(Osc==E5,"STOCHD",WriteIf(Osc==F6," MONEY
FLOW INDEX",WriteIf(Osc==G7," ULTIMATE",WriteIf(Osc==H8,"
ROC(CLOSE)",""))))))));

Plot(Value1, Header,6,1+4); /*BLUE*/
Plot(Value6," O/B",4,1+4); /*RED -TOP(SELL)*/
Plot(Value7," O/S",5,1+4); /*GREEN-BOT(BUY)*/
Plot(Baseline," Baseline",7,1+4); /* yellow*/

Vài dòng nhận xét:

*******Adaptive Zones OB/OS OSCILLATOR********
1. Automatically Adjusts the Overbought and Oversold levels based on past performance.( Lookback ).
The closer the lookback period ( ex. 25, which I like with the RSI ) the more responsive the Zones become.( short term trading ).
2. You can set the sensitivity of the Zones.( ex. 95, 85,80, etc.) Percent. Then interpret the signals as you would with other oscillators.
a) Buy when the oscillator falls below a specific level and then rises above that level.
b) Sell when the oscillator rises above a specific level and then falls below that level.
c) Look for Divergences. ( Ex. When prices are making a series of new highs and the oscillator is failing to surpass it previous highs.
3. Instead of the arbitrary ( 30,70 ) , ( 20,80 ) etc. The Adaptive Zones Automatically adjust the OverBought and OverSold Levels Based on past performance of
the derivitive , which is set with the Lookback Variable ( 60 or closer( 25), seems to give a good interpretation of
current market conditions ) and your Percent setting, giving optimal o/b and o/s levels.
A setting of percent=95, is extreme Buy and sell levels, When the oscillator touches the Top
zone and then Turn down ( Possible Sell ), and when the oscillator touches the Bottom Zone
and Turns up ( Possible Buy ).
4. If Oscillator is continually above the Baseline, market in an uptrend, If Oscillator is continually
Below the Baseline, Market in a Downtrend.

tigeran
27-08-2013, 03:19 PM
Đâ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 Centre of Gravity
Author/Uploader: Robert Dunbar - (email hidden)
Date/Time added: 2012-07-16 08:45:48
Origin: London
Keywords: Adaptive Centre of Gravity, 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: :goku::goku::goku:

//==================================
//==================================
// 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 );
CG = BullSig = BearSig = Trigger = Cycle = InstPeriod = Period = DeltaPhase =
0;

SmoothX = ( PriceIn + 2 * Ref( PriceIn, -1 ) + 2 * Ref( PriceIn, -2 ) + Ref(
PriceIn, -3 ) ) / 6;

for ( i = 10; 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;

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];

IntPeriod[i] = int( Period[i] / 2 );

num = 0;

denom = 0;

for ( j = 0; j < intPeriod[i]; j++ )

num = num + ( 1 + j ) * PriceIn[i - j];
denom = denom + PriceIn[i - j];
}

if ( denom != 0 )
CG[i] = -num / denom + ( IntPeriod[i] + 1 ) / 2;
}

Trigger = Ref( CG, -1 );

BullSig = IIf( Cross( CG, Trigger ), True, False );
BearSig = IIf( Cross( Trigger, CG ), True, False );


Plot( CG, "Adaptive_CG", colorLightBlue, styleLine );
Plot( Trigger, "Trigger", colorRed, styleLine );
Plot( 0 , "", colorWhite, styleDashed );

if ( Arrows )

PlotShapes( shapeUpArrow*BullSig, colorBrightGreen );
PlotShapes( shapeDownArrow*BearSig, colorRed );
}

tigeran
27-08-2013, 03:21 PM
Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker :goku:

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 );
}

tigeran
28-01-2015, 08:56 AM
Giới thiệu các bác chỉ báo mới trong phần mềm phân tích kỹ thuật PTKT AmiBroker :so_funny::so_funny::so_funny::so_funny::so_funny: :so_funny:

Details:
Formula name: Adaptive Laguerre Filter, from John Ehlers
Author/Uploader: Mich -
Date/Time added: 2006-12-01 14:19:58
Origin:
Keywords:
Level: basic
Flags: indicator,function

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. If you believe that formula has an error - contact the AUTHOR directly, not us. If you believe that you have copyright on that work (i.e. you have written this particular code yourself) please send us proper DMCA takedown notice. Please note that mathematical ideas/concepts can not be copyrighted, only actual AFL code if you wrote it yourself.

Description:

Laguerre Filtering, in its adaptive version (alpha is automaticaly adapted depending the error of filtering).
Can be apply to RSI or any other datas like the another Laguerre version on that AFL library :
http://www.amibroker.com/library/detail.php?id=450
To do :
- Kautz Filter, they are generic name for Laguerre Filter and treats complex signals (use amplitude and phase)

Formula:

//
---------------------------------------------------------------------------------------------------------------
//
//
// Adaptive Laguerre Filter, from John Ehlers
// Link :
http://www.mesasoftware.com/Papers/Time%20Warp%20Without%20Space%20Travel.exe
// Another works from Ehlers : http://www.mesasoftware.com/technicalpapers.htm
//
// Description :
// Laguerre Filtering, in its adaptive Version (alpha is automaticaly adapted
depending the error of filtering).
// Can be apply to RSI OR any other datas like the another Laguerre Version on
that AFL library :
// http://www.amibroker.com/library/detail.php?id=450
// To do :
// - Kautz Filter, they are generic Name for Laguerre Filter AND treats complex
signals (use amplitude AND phase)
//
// Coding author: Mich.
//
//
---------------------------------------------------------------------------------------------------------------
//

function ALFilter(price, length, medianlong) **
result=price;
L0 = price;
L1 = price;
L2 = price;
L3 = price;
coef=0.5;
Diff=0;
HH=0.1;
LL=0;
alpha=0.5;

for(i = 1+length; i < BarCount; i++) **
Diff[i] = abs(price[i] - result[i-1]);
HH[i] = Diff[i];
LL[i] = Diff[i];

for(j = 0; j < (length-1); j++) **
if (Diff[i-j] > HH[i]) HH[i] = Diff[i-j];
if (Diff[i-j] < LL[i]) LL[i] = Diff[i-j];
}

if ( (i > length) AND (HH[i] - LL[i] != 0) ) **

// SLOW :
//coef = Median(((Diff - LL) / (HH - LL)), 5);

// FAST :
//----- Speed up the median calculation by placing it inline : Thanks to its
author "Not Too Swift"
coeftemp=(Diff - LL) / (HH - LL);
mlen = medianlong;
for(k = mlen - 1; k >= 0; k--) temparray[k] = coeftemp[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;
}
}
}
coef[i] = temparray[(mlen/2)-0.5];
//----- End median calculation
} // end main IF

alpha=coef[i];
L0[i] = alpha*price[i] + (1 - alpha)*L0[i-1];
L1[i] = -(1 - alpha)*L0[i] + L0[i-1] + (1 - alpha)*L1[i-1];
L2[i] = -(1 - alpha)*L1[i] + L1[i-1] + (1 - alpha)*L2[i-1];
L3[i] = -(1 - alpha)*L2[i] + L2[i-1] + (1 - alpha)*L3[i-1];
result[i] = (L0[i] + 2*L1[i] + 2*L2[i] + L3[i]) / 6;
} // end main FOR

return result;
}


/* DEMO */

SetBarsRequired(2000,2000);

P = ParamField("Price field",-1);
periods = Param( "Periods", 20, 1, 40, 1 );
periodsmedian = Param( "Periods Median", 5, 1, 40, 1 );

Plot( ALFilter(P,periods,periodsmedian), "Adaptive Laguerre Filter", ParamColor(
"Adaptive Laguerre Filter", colorCycle ), ParamStyle("Style") );

traderviet
02-04-2015, 08:32 AM
Các bác không chỉ giỏi phân tích kỹ thuât mà giỏi cả chuyện lập trình nữa. Cao thủ

thanhdatS2
15-09-2015, 08:49 AM
anh oi. sao em nhap code va tao file .afl roi, nhung ma vao phan Custom o muc Charts khong thay file .afl e vua tao. Anh chi nao giup dum e voi :p

tigeran
24-09-2015, 08:31 AM
Bạn xài AmiBroker bản nào thể?

tradingpro8x
15-02-2016, 10:21 AM
AmiBroker bản mới nhất chưa chắc đã tốt nhất đâu nhé

tigeran
30-03-2016, 08:35 AM
cái này bản nào tốt nhất đấy

http://share.vn/PKD/AmiBroker.rar

Mình thấy bản này là ưng ý nhất

Cách cài vào như sau:

- Giải nén file AmiBroker.rar
- Copy thư mục vừa giải nén vào C:\Program Files
- Vào thư mục C:\Program Files\AmiBroker chuột phải vào Broker và chọn Send to\Desktop\Create shortcut
- Sau đó nhấn vào Shortcut trên Desktop và sử dụng

dongphong19
30-03-2016, 08:56 AM
Những gì bạn nói có vẻ đúng. Cảm ơn bạn

tigeran
25-04-2016, 11:24 AM
Dân VN mình thì xài cái gì cứ thích mới nhất, xịn nhất (không riêng gì phần mềm phân tích kỹ thuật) nhưng đôi khi nhu cầu chỉ ở mức sơ đẳng thui

Đấy là còn chưa kể lại toàn xài Win chùa nên các phần mềm mới quá chạy nó hay lỗi lắm :D

Redami
15-11-2016, 04:27 PM
Mình thấy bản này là ưng ý nhất

Cách cài vào như sau:

- Giải nén file AmiBroker.rar
- Copy thư mục vừa giải nén vào C:\Program Files
- Vào thư mục C:\Program Files\AmiBroker chuột phải vào Broker và chọn Send to\Desktop\Create shortcut
- Sau đó nhấn vào Shortcut trên Desktop và sử dụng

Mình đã down về, cài & “vọc” thử, chạy OK, chưa thấy vấn đề gì. Nó là bản AmiBroker 5.20 rc1. Cám ơn bạn rất nhiều.