Saraf_1001

MQL5 エキスパート

指定

//+------------------------------------------------------------------+
//| Pin Bar Indicator (MT5) |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_plots 2

#property indicator_type1 DRAW_ARROW
#property indicator_color1 Blue // Буллиш Pin Bar
#property indicator_width1 2
#property indicator_label1 "Bullish Pin"

#property indicator_type2 DRAW_ARROW
#property indicator_color2 Red // Бериш Pin Bar
#property indicator_width2 2
#property indicator_label2 "Bearish Pin"

double BullPinBuffer[];
double BearPinBuffer[];

input double MinTailToBodyRatio = 2.5; // Думи дароз > ҷисм * 2.5
input int LookbackBars = 500;

int OnInit()
{
   SetIndexBuffer(0, BullPinBuffer, INDICATOR_DATA);
   PlotIndexSetInteger(0, PLOT_ARROW, 233);

   SetIndexBuffer(1, BearPinBuffer, INDICATOR_DATA);
   PlotIndexSetInteger(1, PLOT_ARROW, 234);

   return(INIT_SUCCEEDED);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double& price[])
{
   int start = MathMax(prev_calculated, 1);
   int limit = MathMin(rates_total - 1, LookbackBars);

   for (int i = start; i < limit; i++)
   {
      double open = Open[i];
      double close = Close[i];
      double high = High[i];
      double low = Low[i];

      double body = MathAbs(open - close);
      if (body <= 0) continue;

      double upperTail = high - MathMax(open, close);
      double lowerTail = MathMin(open, close) - low;

      // Bullish Pin Bar (думаш поён)
      if (lowerTail > body * MinTailToBodyRatio)
         BullPinBuffer[i] = low - (SymbolInfoDouble(_Symbol, SYMBOL_POINT) * 5);
      else
         BullPinBuffer[i] = EMPTY_VALUE;

      // Bearish Pin Bar (думаш боло)
      if (upperTail > body * MinTailToBodyRatio)
         BearPinBuffer[i] = high + (SymbolInfoDouble(_Symbol, SYMBOL_POINT) * 5);
      else
         BearPinBuffer[i] = EMPTY_VALUE;
   }

   return(rates_total);
}

応答済み

1
開発者 1
評価
(116)
プロジェクト
137
58%
仲裁
1
0% / 0%
期限切れ
0
2
開発者 2
評価
(16)
プロジェクト
21
29%
仲裁
2
50% / 0%
期限切れ
4
19%
仕事中
3
開発者 3
評価
(298)
プロジェクト
478
40%
仲裁
105
40% / 24%
期限切れ
82
17%
取り込み中
パブリッシュした人: 2 codes
4
開発者 4
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0
パブリッシュした人: 1 code
5
開発者 5
評価
(4)
プロジェクト
4
0%
仲裁
4
25% / 75%
期限切れ
1
25%
6
開発者 6
評価
プロジェクト
0
0%
仲裁
0
期限切れ
0

プロジェクト情報

予算
30+ USD