Wygląda na to, że kod, który dostarczyłem, zawiera błędy składniowe i niekompatybilne elementy z MQL5.
mql5
//+------------------------------------------------------------------+
//| InfinityAlgoRemake.mq5 (MT5) |
//| port Pine-scriptu „Infinity Algo – Remake" |
//| Strzałki BUY/SELL (Buffer-based) bez alertów |
//+------------------------------------------------------------------+
#property copyright "Free / Open-Source"
#property version "2.20"
#property indicator_chart_window
#property indicator_buffers 19
#property indicator_plots 16
//–– 1. SuperTrend --------------------------------------------------
#property indicator_label1 "SuperTrend"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrAqua
#property indicator_style1 STYLE_SOLID
#property indicator_width1 2
//–– 2-14. EMA-y 15-51 (Gradient Kolorów) ---------------------------
// Ciepłe kolory (najbliżej ceny)
#property indicator_label2 "EMA 15"
#property indicator_type2 DRAW_LINE
#property indicator_color2 clrRed
#property indicator_width2 1
#property indicator_label3 "EMA 18"
#property indicator_type3 DRAW_LINE
#property indicator_color3 clrOrangeRed
#property indicator_width3 1
#property indicator_label4 "EMA 21"
#property indicator_type4 DRAW_LINE
#property indicator_color4 clrOrange
#property indicator_width4 1
#property indicator_label5 "EMA 24"
#property indicator_type5 DRAW_LINE
#property indicator_color5 clrGold
#property indicator_width5 1
// Neutralne kolory (środek)
#property indicator_label6 "EMA 27"
#property indicator_type6 DRAW_LINE
#property indicator_color6 clrYellowGreen
#property indicator_width6 1
#property indicator_label7 "EMA 30"
#property indicator_type7 DRAW_LINE
#property indicator_color7 clrLimeGreen
#property indicator_width7 1
#property indicator_label8 "EMA 33"
#property indicator_type8 DRAW_LINE
#property indicator_color8 clrMediumSeaGreen
#property indicator_width8 1
#property indicator_label9 "EMA 36"
#property indicator_type9 DRAW_LINE
#property indicator_color9 clrSeaGreen
#property indicator_width9 1
// Zimne kolory (najdalej od ceny)
#property indicator_label10 "EMA 39"
#property indicator_type10 DRAW_LINE
#property indicator_color10 clrSkyBlue
#property indicator_width10 1
#property indicator_label11 "EMA 42"
#property indicator_type11 DRAW_LINE
#property indicator_color11 clrDeepSkyBlue
#property indicator_width11 1
#property indicator_label12 "EMA 45"
#property indicator_type12 DRAW_LINE
#property indicator_color12 clrRoyalBlue
#property indicator_width12 1
#property indicator_label13 "EMA 48"
#property indicator_type13 DRAW_LINE
#property indicator_color13 clrMediumPurple
#property indicator_width13 1
#property indicator_label14 "EMA 51"
#property indicator_type14 DRAW_LINE
#property indicator_color14 clrDarkViolet
#property indicator_width14 1
//–– 15-16. Strzałki Sygnałowe (DRAW_ARROW) --------------------------
#property indicator_label15 "Buy Signal"
#property indicator_type15 DRAW_ARROW
// Kolory i szerokość ustawiane dynamicznie w OnInit
#property indicator_label16 "Sell Signal"
#property indicator_type16 DRAW_ARROW
// Kolory i szerokość ustawiane dynamicznie w OnInit
//===================================================================
// PARAMETRY UŻYTKOWNIKA
//===================================================================
input group "Ustawienia Wskaźnika"
input double InpSensitivity = 3.5; // Czułość Supertrendu
input int InpKeltnerLength = 9; // Długość SMA dla Keltnera
input double InpFactor = 2.0; // Mnożnik pasma
input bool InpShowEMAs = true; // Pokaż EMA-y?
input group "Ustawienia Strzałek"
input color InpBuyArrowColor = clrOrange; // Kolor strzałki kupna (w dół)
input color InpSellArrowColor = clrLightBlue; // Kolor strzałki sprzedaży (w górę)
input int InpArrowSize = 3; // Wielkość strzałek (1-5)
input int InpArrowShiftPoints = 50; // Odległość od ceny (pkt)
//===================================================================
// BUFORY
//===================================================================
double SupTrend[];
double EMA15[], EMA18[], EMA21[], EMA24[], EMA27[], EMA30[], EMA33[];
double EMA36[], EMA39[], EMA42[], EMA45[], EMA48[], EMA51[];
// Nowe bufory dla strzałek
double BuyArrows[], SellArrows[];
// Bufory obliczeniowe
double UpBand[], DnBand[], DirBuf[];
//===================================================================
// UCHWYTY EMA / SMA
//===================================================================
int emaHandle[13];
int smaHandle = INVALID_HANDLE;
int emaPer[13] = {15,18,21,24,27,30,33,36,39,42,45,48,51};
//===================================================================
// INICJALIZACJA
//===================================================================
int OnInit()
{
ChartSetInteger(0, CHART_BRING_TO_TOP, true);
// Bufory Danych (Linie)
SetIndexBuffer(0, SupTrend, INDICATOR_DATA);
SetIndexBuffer(1, EMA15, INDICATOR_DATA);
SetIndexBuffer(2, EMA18, INDICATOR_DATA);
SetIndexBuffer(3, EMA21, INDICATOR_DATA);
SetIndexBuffer(4, EMA24, INDICATOR_DATA);
SetIndexBuffer(5, EMA27, INDICATOR_DATA);
SetIndexBuffer(6, EMA30, INDICATOR_DATA);
SetIndexBuffer(7, EMA33, INDICATOR_DATA);
SetIndexBuffer(8, EMA36, INDICATOR_DATA);
SetIndexBuffer(9, EMA39, INDICATOR_DATA);
SetIndexBuffer(10, EMA42, INDICATOR_DATA);
SetIndexBuffer(11, EMA45, INDICATOR_DATA);
SetIndexBuffer(12, EMA48, INDICATOR_DATA);
SetIndexBuffer(13, EMA51, INDICATOR_DATA);
// Bufory Danych (Strzałki)
SetIndexBuffer(14, BuyArrows, INDICATOR_DATA);
SetIndexBuffer(15, SellArrows, INDICATOR_DATA);
// Bufory Obliczeniowe
SetIndexBuffer(16, UpBand, INDICATOR_CALCULATIONS);
SetIndexBuffer(17, DnBand, INDICATOR_CALCULATIONS);
SetIndexBuffer(18, DirBuf, INDICATOR_CALCULATIONS);
// Ustawienie kodów strzałek (Wingdings)
PlotIndexSetInteger(14, PLOT_ARROW, 233); // Strzałka w dół (Kupno)
PlotIndexSetInteger(15, PLOT_ARROW, 234); // Strzałka w górę (Sprzedaż)
// Ustawienie kolorów z parametrów użytkownika
PlotIndexSetInteger(14, PLOT_LINE_COLOR, InpBuyArrowColor);
PlotIndexSetInteger(15, PLOT_LINE_COLOR, InpSellArrowColor);
// Ustawienie wielkości z parametrów użytkownika
int arrow_size = InpArrowSize;
if (arrow_size < 1) arrow_size = 1;
if (arrow_size > 5) arrow_size = 5;
PlotIndexSetInteger(14, PLOT_LINE_WIDTH, arrow_size);
PlotIndexSetInteger(15, PLOT_LINE_WIDTH, arrow_size);
// Ustawienie EMPTY_VALUE dla strzałek
PlotIndexSetDouble(14, PLOT_EMPTY_VALUE, EMPTY_VALUE);
PlotIndexSetDouble(15, PLOT_EMPTY_VALUE, EMPTY_VALUE);
// Tworzenie uchwytów EMA
for(int n=0; n<13; n++)
{
emaHandle[n] = iMA(_Symbol, _Period, emaPer[n], 0, MODE_EMA, PRICE_HIGH);
if(emaHandle[n] == INVALID_HANDLE)
{
Print("Błąd tworzenia EMA(", emaPer[n], ")");
return INIT_FAILED;
}
}
// SMA Keltnera
smaHandle = iMA(_Symbol, _Period, InpKeltnerLength, 0, MODE_SMA, PRICE_CLOSE);
if(smaHandle == INVALID_HANDLE)
{
Print("Błąd tworzenia SMA Keltnera");
return INIT_FAILED;
}
Print("Wskaźnik zainicjalizowany.");
return INIT_SUCCEEDED;
}
//===================================================================
// DEINIT
//===================================================================
void OnDeinit(const int reason)
{
// Nie musimy już usuwać obiektów (BUY_/SELL_), ponieważ