Những series bài hay về phần mềm phân tích kỹ thuật AmiBroker
  • Thông báo


    + Trả lời Chủ đề
    Trang 1 của 2 1 2 CuốiCuối
    Kết quả 1 đến 20 của 38
    1. #1
      Ngày tham gia
      Oct 2009
      Bài viết
      1,925
      Được cám ơn 617 lần trong 428 bài gởi

      Mặc định Những series bài hay về phần mềm phân tích kỹ thuật AmiBroker

      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é


    2. #2
      Ngày tham gia
      Oct 2009
      Bài viết
      1,925
      Được cám ơn 617 lần trong 428 bài gởi

      Mặc định Phân tích kỹ thuật - AmiBroker Code

      Đâ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

    3. #3
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Phân tích kỹ thuật - AmiBroker Code (tt)

      Đâ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: questions@CodeForTraders.com).

      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.

    4. #4
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Phân tích kỹ thuật - AmiBroker Code (tt)

      Đâ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!).

    5. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    6. #5
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Phân tích kỹ thuật - AmiBroker Code (tt)

      Đâ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!).

    7. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    8. #6
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Phân tích kỹ thuật - AmiBroker Code (tt)

      Đâ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!).

    9. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    10. #7
      Ngày tham gia
      Aug 2010
      Bài viết
      648
      Được cám ơn 325 lần trong 218 bài gởi

      Mặc định Những series bài hay về phần mềm phân tích kỹ thuật AmiBroker

      Đâ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();

    11. #8
      Ngày tham gia
      Aug 2010
      Bài viết
      648
      Được cám ơn 325 lần trong 218 bài gởi

      Mặc định Những series bài hay về phần mềm phân tích kỹ thuật AmiBroker

      Đâ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: http://www.tradinganalysis.co.in/Ami.../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
      Last edited by tradingpro8x; 12-09-2012 at 02:07 PM.

    12. #9
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: Pivots And Prices And Swing Volume
      Author/Uploader: reinsley - (email hidden)
      Date/Time added: 2010-04-21 03:54:16
      Origin:
      Keywords: volume swing pivot
      Level: basic
      Flags: indicator

      Description:

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

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

      Formula:

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

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


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

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

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

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

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

      while ( i > 0 )
      **

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


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

      i--;
      }


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

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


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

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

      _SECTION_END();

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

      /*
      Volbar = TimeFrameGetPrice( "V", in1Minute * 20, 0 );
      _TRACE( "Volbar = " + Volbar );
      */
      // Seconds Remaining

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

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

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

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

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

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

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

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

      zzup = zzHiLo > Ref( zzHiLo, -1 ) ;
      zzdn = zzHiLo < Ref( zzHiLo, -1 );
      ribboncol = IIf( zzup , colorWhite, colorBlack );
      // Plot the Zig ribbon
      Plot ( 1, "", ribboncol, styleArea | styleOwnScale | styleNoLabel, 0, 100 );

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

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

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

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

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

      if ( VolON == 1 )
      **
      PlotText( "" + Volswing , i + 2 , zzHiLo[BarCount-1], LastValue( ribboncol
      ) );
      }

      GraphXSpace = xspace;

    13. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    14. #10
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: % 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);

    15. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    16. #11
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: %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 );

    17. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    18. #12
      Ngày tham gia
      Oct 2009
      Bài viết
      1,925
      Được cám ơn 617 lần trong 428 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: '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 );

    19. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    20. #13
      Ngày tham gia
      Oct 2009
      Bài viết
      1,925
      Được cám ơn 617 lần trong 428 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: 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();

    21. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    22. #14
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: 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();
      Cuộc đời tàn nhẫn nuôi anh lớn
      Xã hội khốn nạn dạy anh khôn

    23. Có 2 thành viên đã cám ơn 1nightdream :
      tigeran (10-08-2013), tradingpro8x (12-08-2013)

    24. #15
      Ngày tham gia
      Aug 2010
      Bài viết
      648
      Được cám ơn 325 lần trong 218 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật MetaStock

      Đâ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

    25. Những thành viên sau đã cám ơn :
      tigeran (10-08-2013)

    26. #16
      Ngày tham gia
      Oct 2003
      Bài viết
      365
      Được cám ơn 215 lần trong 148 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: 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);
      Cuộc đời tàn nhẫn nuôi anh lớn
      Xã hội khốn nạn dạy anh khôn

    27. Có 2 thành viên đã cám ơn 1nightdream :
      tigeran (10-08-2013), tradingpro8x (12-08-2013)

    28. #17
      Ngày tham gia
      Aug 2010
      Bài viết
      648
      Được cám ơn 325 lần trong 218 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

      Đây là loạt bài AmiBroker AFL Library về phần mềm phân tích kỹ thuật PTKT AmiBroker

      Details:

      Formula name: 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",col orBlue,styleLine);

    29. #18
      Ngày tham gia
      Aug 2013
      Bài viết
      10
      Được cám ơn 5 lần trong 3 bài gởi

      Mặc định phân tích kỹ thật

      Kể bằng tiếng việt thì tốt .

    30. #19
      Ngày tham gia
      Oct 2009
      Bài viết
      1,925
      Được cám ơn 617 lần trong 428 bài gởi

      Mặc định Kinh nghiệm phân tích kỹ thuật PTKT và đầu tư trên thị trường chứng khoán

      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

    31. Những thành viên sau đã cám ơn :
      tradingpro8x (12-08-2013)

    32. #20
      Ngày tham gia
      Aug 2010
      Bài viết
      648
      Được cám ơn 325 lần trong 218 bài gởi

      Mặc định Những series bài hay về phần mềm PTKT phân tích kỹ thuật AmiBroker

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

    33. Những thành viên sau đã cám ơn :
      tigeran (27-08-2013)

    Thông tin của chủ đề

    Users Browsing this Thread

    Có 4 thành viên đang xem chủ đề này. (0 thành viên và 4 khách vãng lai)

       

    Similar Threads

    1. Một bài phân tích hay, có lý và khách quan
      By Brainstorm in forum Thảo luận Tình hình
      Trả lời: 0
      Bài viết cuối: 17-06-2012, 11:41 PM
    2. Phần mềm phân tích kỹ thuật
      By waterloo1815 in forum CLB Chứng khoán
      Trả lời: 2
      Bài viết cuối: 28-10-2009, 11:32 PM

    Bookmarks

    Quyền viết bài

    • Bạn Không thể gửi Chủ đề mới
    • Bạn Không thể Gửi trả lời
    • Bạn Không thể Gửi file đính kèm
    • Bạn Không thể Sửa bài viết của mình