mql4 APB

Average Price Bar.mq4

APB 比 HEIKIN ASHI 少运算一步,不会出现长长的下影线和上影线,长影线也代表着 HEIKIN ASHI 的力度,可以看做动量指标,但是对于看惯 K 线的人反直觉,可以用 APB,在蜡烛图染色上与 HEIKIN ASHI 几乎一致。

//+------------------------------------------------------------------+
//|                                            Average Price Bar.mq4 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
//| For Average Price Bars you can use chart settings (press F8)
//| or  select on the menu 'Charts'->'Properties...')                                       |
//| - On 'Color' Tab select 'Black' for 'Line Graph' to see yourn Bid price
//| - On 'Common' Tab disable 'Chart on Foreground' checkbox and select 'Line Chart' button
//| - use the indciator properties to select your preferred opeions for
//| - bar colours and width ...                         |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2011  "
#property link      " "

#property indicator_chart_window
#property indicator_buffers 4
#property indicator_color1 Crimson
#property indicator_color2 SteelBlue
#property indicator_color3 Crimson
#property indicator_color4 SteelBlue
#property indicator_width1 1
#property indicator_width2 1
#property indicator_width3 3
#property indicator_width4 3
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];

//----
int ExtCountedBars = 0;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//|------------------------------------------------------------------|
int init() {
    SetIndexStyle(0, DRAW_HISTOGRAM, STYLE_SOLID);//, Red);
    SetIndexBuffer(0, ExtMapBuffer1);
    SetIndexLabel(0, "HA_0");
    SetIndexStyle(1, DRAW_HISTOGRAM, STYLE_SOLID);//, Blue);
    SetIndexBuffer(1, ExtMapBuffer2);
    SetIndexLabel(1, "HA_1");
    SetIndexStyle(2, DRAW_HISTOGRAM, STYLE_SOLID);//, Red);
    SetIndexBuffer(2, ExtMapBuffer3);
    SetIndexLabel(2, "HA_Open");
    SetIndexStyle(3, DRAW_HISTOGRAM, STYLE_SOLID);//, Blue);
    SetIndexBuffer(3, ExtMapBuffer4);
    SetIndexLabel(3, "HA_Close");
    SetIndexDrawBegin(0, 10);
    SetIndexDrawBegin(1, 10);
    SetIndexDrawBegin(2, 10);
    SetIndexDrawBegin(3, 10);
    SetIndexBuffer(0, ExtMapBuffer1);
    SetIndexBuffer(1, ExtMapBuffer2);
    SetIndexBuffer(2, ExtMapBuffer3);
    SetIndexBuffer(3, ExtMapBuffer4);
    return (0);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit() {
    return (0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
    double APBOpen;
    double APBHigh;
    double APBLow;
    double APBClose;
    if (Bars <= 10) return (0);
    ExtCountedBars = IndicatorCounted();
//---- check for possible errors
    if (ExtCountedBars < 0) return (-1);
//---- last counted bar will be recounted
    if (ExtCountedBars > 0) ExtCountedBars--;
    for (int Pos = Bars - ExtCountedBars - 1; Pos >= 0; Pos--) {
        APBClose = NormalizeDouble((Open[Pos] + High[Pos] + Low[Pos] + Close[Pos]) / 4.0, Digits);
        APBClose = (APBClose + Close[Pos]) / 2.0;
        APBOpen = (ExtMapBuffer3[Pos + 1] + (ExtMapBuffer4[Pos + 1])) / 2.0;
        APBHigh = MathMax(High[Pos], MathMax(APBOpen, APBClose));
        APBLow = MathMin(Low[Pos], MathMin(APBOpen, APBClose));
        if (APBOpen < APBClose) {
            ExtMapBuffer1[Pos] = APBLow;
            ExtMapBuffer2[Pos] = APBHigh;
        } else {
            ExtMapBuffer1[Pos] = APBHigh;
            ExtMapBuffer2[Pos] = APBLow;
        }
        ExtMapBuffer3[Pos] = APBOpen;
        ExtMapBuffer4[Pos] = APBClose;
    }
    return (0);
}
//+------------------------------------------------------------------+
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇