Czy ktoś może mi pomóc z tym kodem? . . .
Pokaż wyniki od 1 do 5 z 5

Wątek: Czy ktoś może mi pomóc z tym kodem? . . .

  1. #1
    Cześć chłopaki,

    Czy ktoś mógłby mi z tym pomóc.

    Gdy warunek jest spełniony dla wyskakującego alertu, ciągle pojawia się co kilka sekund dla okresu paska. Uruchomiłem to na wykresach jednogodzinnych, ale ciągle wymuszam wyskakiwanie okna alertu.

    Ponadto, jeśli uda mi się zatrzymać pojawienie się (tak, że jestem tylko powiadomiony raz), resetuje alarm tak, jeśli zostanie wyzwolony w czasie 3 taktów, jeśli warunek będzie znowu prawdziwy.

    Jeśli ktokolwiek będzie w stanie pomóc, docenię to.

    pozdrowienia
    Steve



    // ----------------------------------------------- -------------------
    //| My_First_Indior.mq4 |
    //|
    http://www.forex-tsd.com|
    // ----------------------------------------------- -------------------
    #property copyright Steve Dawson
    #property indior_separate_window
    #property indior_buffers 2
    #property indior_color1 Czerwony
    #property indior_color2 Zielony
    //---- bufory
    double ExtMapBuffer1 [];
    double ExtMapBuffer2 [];
    bool buf_alert_already_triggered;
    // ----------------------------------------------- -------------------
    //| Funkcja inicjalizacji wskaźnika niestandardowego |
    // ----------------------------------------------- -------------------
    int init ()
    {
    //---- wskaźniki
    SetIndexStyle (0, DRAW_HISTOGRAM, EMPTY, 3);
    SetIndexBuffer (0, ExtMapBuffer1);
    SetIndexStyle (1, DRAW_HISTOGRAM, EMPTY, 3);
    SetIndexBuffer (1, ExtMapBuffer2);
    string short_name = MAX - Histogram OBOS z alertami !;
    IndiorShortName (short_name);
    return (1);
    }
    // ----------------------------------------------- -------------------
    //| Funkcja dezinicjalizacji wskaźnika kalibracji |
    // ----------------------------------------------- -------------------
    int deinit ()
    {
    //----
    //----
    return (0);
    }
    // ----------------------------------------------- -------------------
    //| Funkcja iteracji wskaźnika niestandardowego |
    // ----------------------------------------------- -------------------
    int start ()
    {
    int counted_bars = IndiorCounted ();
    //---- sprawdź możliwe błędy
    if (counted_barslt; 0) return (-1);
    //---- ostatni zliczony pasek zostanie zliczony
    if (counted_barsgt; 0) counted_bars--;
    int pos = Bars-counted_bars;
    podwójne dVal, dLow, dResult, value;
    Komentarz (Cześć! Jestem tutaj na głównym oknie mapy!);
    //---- główna pętla obliczeniowa do załadowania ArrayBsearch
    while (posgt; = 0)
    {
    dVal = iCustom (NULL, 0, J_TPO, 13,0, pos);
    if (dVal gt; 0)
    {
    dResult = 1;
    }
    jeszcze
    {
    dResult = -1;
    }

    //Tu jest kolor ustawiony
    jeśli (dResult == 1)
    {
    ExtMapBuffer2 [pos] = dResult;
    }
    jeszcze
    {
    ExtMapBuffer1 [pos] = dResult;
    }



    //ExtMapBuffer1 [pos] = dResult;
    poz = pos - 1;
    }
    //---- bufor został załadowany

    //Wykonaj teraz alert
    if (((((ExtMapBuffer1 [0] == 1) || (ExtMapBuffer2 [0] == 1)) ((ExtMapBuffer1 [1] == -1) || (ExtMapBuffer2 [1] == -1))) (buf_alert_already_triggered == 0))
    {
    Alert (Możliwa kasa dla, Symbol (), włączony, okres (), wykres!);
    buf_alert_already_triggered = 1;
    } else
    {
    buf_alert_already_triggered = 0;
    }

    if (((((ExtMapBuffer1 [0] == -1) || (ExtMapBuffer2 [0] == -1)) ((ExtMapBuffer1 [1] == 1)) || (ExtMapBuffer2 [1] == 1)) (buf_alert_already_triggered == 0))
    {
    Alert (Możliwa SPRZEDAĆ dla, Symbol (), włączony, Okres (), wykres!);
    buf_alert_already_triggered = 1;
    } else
    {
    buf_alert_already_triggered = 0;
    }
    //----
    return (0);
    }
    // ----------------------------------------------- -------------------

  2. #2
    ta część ustawia z powrotem na 0} else {buf_alert_already_triggered = 0; } musisz to zmienić

  3. #3
    Dzięki Tomowi działa teraz świetnie. Jeszcze jedno pytanie, jeśli nie masz nic przeciwko. Jeśli, powiedzmy, 10 słupków, alarm ma być ponownie wywołany, co się stanie? Czy zmienna zostanie zresetowana na następnym pasku, czy alert nie zadziała ponownie, dopóki nie uruchomię ponownie platformy? Dzięki Steve

  4. #4
    musisz w jakiś sposób ustawić go z powrotem na 0

  5. #5
    #property indior_chart_window #property indior_buffers 8 #property indior_color1 Magenta #property indior_color2 Aqua #property indior_color3 Magenta #property indior_color4 Aqua #property indior_color5 Magenta #property indior_color6 Aqua #property indior_color7 Magenta #property indior_color8 Aqua/---- parametry wejściowe extern podwójne stoch_period = 9; extern double stoch_max = 53; extern double stoch_min = 47; extern double atr_current_norm_factor = 0.435; extern double atr_before_norm_factor = 1,5; extern double atr_period = 7; extern int atr_before_step = 1; extern int NumBars = 10000;/Jeśli chcesz wyświetlić WSZYSTKIE wartości wskaźników, ustaw to na 0 - użyje więcej pamięci przyczyny/---- buforów double sell_stop_dot_buf []; double buy_stop_dot_buf []; double sell_stop_line_buf []; double buy_stop_line_buf []; double sell_signal_buf []; double buy_signal_buf []; double down_buf []; double up_buf []; int init () {SetIndexStyle (0, DRAW_ARROW); SetIndexArrow (0,115); SetIndexBuffer (0, sell_stop_dot_buf); SetIndexLabel (0, sell_stop_dot); SetIndexEmptyValue (0, EMPTY_VALUE); SetIndexStyle (1, DRAW_ARROW); SetIndexArrow (1,115); SetIndexBuffer (1, buy_stop_dot_buf); SetIndexLabel (1, buy_stop_dot); SetIndexEmptyValue (1, EMPTY_VALUE); SetIndexStyle (2, DRAW_LINE); SetIndexBuffer (2, sell_stop_line_buf); SetIndexLabel (2, sell_stop_line); SetIndexEmptyValue (2, EMPTY_VALUE); SetIndexStyle (3, DRAW_LINE); SetIndexBuffer (3, buy_stop_line_buf); SetIndexLabel (3, buy_stop_line); SetIndexEmptyValue (3, EMPTY_VALUE); SetIndexStyle (4, DRAW_ARROW); SetIndexArrow (4108); SetIndexBuffer (4, sell_signal_buf); SetIndexLabel (4, sell_signal); SetIndexEmptyValue (4, EMPTY_VALUE); SetIndexStyle (5, DRAW_ARROW); SetIndexArrow (5108); SetIndexBuffer (5, buy_signal_buf); SetIndexLabel (5, buy_signal); SetIndexEmptyValue (5, EMPTY_VALUE); SetIndexStyle (6, DRAW_HISTOGRAM); SetIndexBuffer (6, down_buf); SetIndexLabel (6, down_trend); SetIndexStyle (7, DRAW_HISTOGRAM); SetIndexBuffer (7, up_buf); SetIndexLabel (7, up_trend); } int start () {double stoch_current, atr_current_normalised, atr_before_normalised; double value3, value4, value5, val1, val2, close_diff, r; int flag1, flag2;/flags = 1, gdy para szybko spada. Stoch znajduje się poniżej stoch_min, a diff in Closes przekracza atr_current_normalised./flags = 2, gdy para szybko rośnie. Stoch jest powyżej stoch_max, a diff in Closes przekracza atr_current_normalised. if (NumBars == 0) int shift = Bars - MathMax (stoch_period, atr_period); else shift = MathMax (Bars, NumBars) - MathMax (stoch_period, atr_period); while (shiftgt; = 0) {atr_current_normalised = iATR (NULL, 0, atr_period, shift) * atr_current_norm_factor; atr_before_normalised = atr_before_norm_factor * iATR (NULL, 0, atr_period atr_before_step, shift);stoch_current = iStochastic (NULL, 0, stoch_period, stoch_period, 1,0,0,0, shift); val1 = 0; val2 = 0; value4 = High [shift] atr_before_normalised; value5 = Low [shift] - atr_before_normalised; close_diff = MathAbs (Close [shift] - Close [shift 2]);/Process Sharp Drops Powstaje, jeśli (close_diff gt; atr_current_normalised) jeśli (stoch_current lt; stoch_min flag1! = 1)/para szybko spada {value3 = High [shift] atr_before_normalised4; flag1 = 1; val1 = wartość3; r = wartość3; sell_signal_buf [shift] = value3; sell_stop_line_buf [shift] = value3; } else if (stoch_current gt; stoch_max flag1! = 2)/Para szybko rośnie {value3 = Low [shift] - atr_before_normalised4; flag1 = 2; val2 = wartość3; r = wartość3; buy_signal_buf [shift] = value3; buy_stop_line_buf [shift] = value3; }/Process small Drops Rises, jeśli (val1 == 0 val2 == 0)/switch (flag1) {case 1: if (wartość4 lt; r) {r = wartość4; } sell_stop_dot_buf [shift] = r; sell_stop_line_buf [shift] = r; przerwa; przypadek 2: if (wartość5 gt; r) {r = wartość5; } buy_stop_dot_buf [shift] = r; buy_stop_line_buf [shift] = r; przerwa; } if (close_diff gt; atr_current_normalised) {if (stoch_current lt; stoch_min) flag2 = 1; else if (stoch_current gt; stoch_max) flag2 = 2; } if ((stoch_current lt; stoch_min flag2 == 1) || (stoch_current lt; stoch_min flag2 == 0)) {if (close_diff gt; atr_current_normalised) {down_buf [shift] = High [shift]; up_buf [shift] = Low [shift]; }} else jeśli ((stoch_current gt; stoch_max flag2 == 2) || (stoch_current gt; stoch_max flag2 == 0)) {up_buf [shift] = High [shift]; down_buf [shift] = Low [shift]; }/------------------------------------------ shift--; }}

Uprawnienia umieszczania postów

  • Nie możesz zakładać nowych tematów
  • Nie możesz pisać wiadomości
  • Nie możesz dodawać załączników
  • Nie możesz edytować swoich postów
  •  
Używamy cookies
Używamy cookies, aby jak najlepiej dostosować witrynę do Twoich potrzeb. Kontynuowanie przeglądania tej strony, oznacza zgodę na używanie plików cookies. Aby uzyskać więcej informacji zapoznaj się z naszą Polityką Prywatności.