Coding with Copilot: I made an MT4 indicator, and you can too! (in real-time!) 2 Oct 2023

Поделиться
HTML-код
  • Опубликовано: 5 сен 2024
  • Copilot is Microsoft's recently unveiled answer to ChatGPT, and in this video I use it to help me create an MT4 indicator from scratch. It's not all smooth running, but you get to see the problem-solving and if it really works. This video shows it all from start to finish for a first-time user.
    Here is the MT5 version: • *New* Coding with Copi...
    #chatgpt #mt4 #Copilot
    My Corporate Clients include:
    ICE Exchange, CME Group, NADEX, TradeStation, IG Index, CMC Markets, ADSS, OANDA, RJO Futures, ForexLive, Gain Capital, City Index, and Vantage.
    This broker-independent channel is for those of you who want to build real-world technical skills, iron-out any psychological kinks, gain consistency in your trading results, and experience measurable improvements in your trading. There is also room for folks to see how the markets truly operate, instead of peddling conspiracy theories.
    I am a multi-account trader, author, event-speaker, and private mentor for trading enthusiasts.
    Corporate Premium Content:
    Trade With Precision: tradewithpreci...
    My Charting Platform:
    ProRealTime: trading.prorea...
    Mentoring: Please email me directly at adampeterharris@gmail.com
    Daily Chatroom:
    ForexVox: forexvox.echof...
    Exclusive content: Fineco Bank: finecobank.co....
    Speaking events:
    Simon Campbell: roundtheclockt...
    The London Investors Show: www.londoninve...
    The London Trader Show: www.londontrad...
    The IX Investor Show: www.ixinvestor...
    DISCLAIMER: The information contained in this video is for educational and informational purposes only and is not intended as financial or investment advice. The content of this video represents the opinions of the speaker and is not intended to be a recommendation, offer, or solicitation for the purchase or sale of any financial instruments.
    Trading involves risk, and past performance is not indicative of future results. Statistics show that many losses occur due to lack of education and training. Fewer losses are incurred when a strict risk management plan is adhered to.
    You should always do your own research and consult with a licensed financial advisor before making any investment decisions. The speaker and the platform on which this video is hosted are not responsible for any losses or damages that may arise from any investments you make based on the information presented in this video.

Комментарии • 18

  • @AdamHarrisTrader
    @AdamHarrisTrader  9 месяцев назад +1

    Here's the code:
    //+------------------------------------------------------------------+
    //| Engulfing Candle Indicator.mq4 |
    //| Author: Bing |
    //| Description: This indicator will highlight engulfing candlesticks |
    //| on the chart and alert the user when they occur. |
    //+------------------------------------------------------------------+
    #property indicator_chart_window
    #property indicator_buffers 2
    #property indicator_color1 Blue
    #property indicator_color2 Red
    #property indicator_width1 2
    #property indicator_width2 2
    double UpBuffer[];
    double DownBuffer[];
    input int AlertPeriod = 0; // Set to 0 to disable alerts, or to a positive number to specify the number of bars to look back for engulfing patterns
    //+------------------------------------------------------------------+
    //| Initialization function |
    //+------------------------------------------------------------------+
    int OnInit()
    {
    SetIndexBuffer(0, UpBuffer);
    SetIndexStyle(0, DRAW_ARROW);
    SetIndexArrow(0, 108); // Dot code for blue buffer

    SetIndexBuffer(1, DownBuffer);
    SetIndexStyle(1, DRAW_ARROW);
    SetIndexArrow(1, 110); // Dot code for red buffer

    return(INIT_SUCCEEDED);
    }
    //+------------------------------------------------------------------+
    //| Deinitialization function |
    //+------------------------------------------------------------------+
    void OnDeinit(const int reason)
    {
    // Add any code that you want to execute when the indicator is removed from the chart
    }
    //+------------------------------------------------------------------+
    //| Calculation function |
    //+------------------------------------------------------------------+
    int OnCalculate(const int rates_total,
    const int prev_calculated,
    const datetime &time[],
    const double &open[],
    const double &high[],
    const double &low[],
    const double &close[],
    const long &tick_volume[],
    const long &volume[],
    const int &spread[])
    {
    int limit = rates_total - prev_calculated;

    for(int i = limit; i >= 0; i--)
    {
    UpBuffer[i] = EMPTY_VALUE;
    DownBuffer[i] = EMPTY_VALUE;

    if(IsBullishEngulfing(i, open, high, low, close))
    {
    UpBuffer[i] = low[i] - (high[i] - low[i]) * 0.1; // Place the dot below the low of the engulfing bar
    if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
    {
    Alert(Symbol(), " ", Period(), " - Bullish Engulfing Pattern at bar ", i);
    }
    }

    if(IsBearishEngulfing(i, open, high, low, close))
    {
    DownBuffer[i] = high[i] + (high[i] - low[i]) * 0.1; // Place the dot above the high of the engulfing bar
    if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
    {
    Alert(Symbol(), " ", Period(), " - Bearish Engulfing Pattern at bar ", i);
    }
    }
    }

    return(rates_total);
    }
    //+------------------------------------------------------------------+
    //| Check if a bar is a bullish engulfing pattern |
    //+------------------------------------------------------------------+
    bool IsBullishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
    {
    if(close[index] > open[index] && close[index+1] < open[index+1]) // Check if the current bar is bullish and the previous bar is bearish
    {
    if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
    {
    return(true);
    }
    }

    return(false);
    }
    //+------------------------------------------------------------------+
    //| Check if a bar is a bearish engulfing pattern |
    //+------------------------------------------------------------------+
    bool IsBearishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
    {
    if(close[index] < open[index] && close[index+1] > open[index+1]) // Check if the current bar is bearish and the previous bar is bullish
    {
    if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
    {
    return(true);
    }
    }

    return(false);
    }

  • @alanriback65
    @alanriback65 11 месяцев назад +3

    Very interesting, a little scary where we are heading!

    • @AdamHarrisTrader
      @AdamHarrisTrader  11 месяцев назад

      Exactly that- scary and exciting. Hard to keep up with it all.

  • @usmanmir7597
    @usmanmir7597 11 месяцев назад +1

    Hi Adam,
    This is very interesting. Thank you.

  • @ArtenPlay
    @ArtenPlay 11 месяцев назад +1

    Amazing stuff!
    I am gonna try creating a currency strength meter with it.
    Thanks Adam!

    • @AdamHarrisTrader
      @AdamHarrisTrader  11 месяцев назад +1

      Go for it! I was wondering if there's a way to create an indicator the shows the central bank interest rate- that might translate into a stronger/weaker currency... need to think on this. Could be a good momentum indicator.

  • @candlemcstick4024
    @candlemcstick4024 7 месяцев назад

    Thanks for posting it.

  • @richardbarile788
    @richardbarile788 6 месяцев назад +1

    You should do this programming video in of MT4 & MT5 in ChatGPT or Copilot with other indicators more often. I'm learning from you video on to use AI.

  • @keepupandplayon
    @keepupandplayon 11 месяцев назад +1

    Thank you Adam. This is great. Are you going to create the video on how to use this indicator for real trading?

    • @AdamHarrisTrader
      @AdamHarrisTrader  11 месяцев назад

      Absolutely! Hopefully in the next week or two.

  • @tshepomolaba1427
    @tshepomolaba1427 10 месяцев назад +1

    Great indicator. Can I please have the code? I tried coding it. But it just doesn’t highlight engulfing candle patterns.

    • @AdamHarrisTrader
      @AdamHarrisTrader  9 месяцев назад

      Here it is:
      //+------------------------------------------------------------------+
      //| Engulfing Candle Indicator.mq4 |
      //| Author: Bing |
      //| Description: This indicator will highlight engulfing candlesticks |
      //| on the chart and alert the user when they occur. |
      //+------------------------------------------------------------------+
      #property indicator_chart_window
      #property indicator_buffers 2
      #property indicator_color1 Blue
      #property indicator_color2 Red
      #property indicator_width1 2
      #property indicator_width2 2
      double UpBuffer[];
      double DownBuffer[];
      input int AlertPeriod = 0; // Set to 0 to disable alerts, or to a positive number to specify the number of bars to look back for engulfing patterns
      //+------------------------------------------------------------------+
      //| Initialization function |
      //+------------------------------------------------------------------+
      int OnInit()
      {
      SetIndexBuffer(0, UpBuffer);
      SetIndexStyle(0, DRAW_ARROW);
      SetIndexArrow(0, 108); // Dot code for blue buffer

      SetIndexBuffer(1, DownBuffer);
      SetIndexStyle(1, DRAW_ARROW);
      SetIndexArrow(1, 110); // Dot code for red buffer

      return(INIT_SUCCEEDED);
      }
      //+------------------------------------------------------------------+
      //| Deinitialization function |
      //+------------------------------------------------------------------+
      void OnDeinit(const int reason)
      {
      // Add any code that you want to execute when the indicator is removed from the chart
      }
      //+------------------------------------------------------------------+
      //| Calculation function |
      //+------------------------------------------------------------------+
      int OnCalculate(const int rates_total,
      const int prev_calculated,
      const datetime &time[],
      const double &open[],
      const double &high[],
      const double &low[],
      const double &close[],
      const long &tick_volume[],
      const long &volume[],
      const int &spread[])
      {
      int limit = rates_total - prev_calculated;

      for(int i = limit; i >= 0; i--)
      {
      UpBuffer[i] = EMPTY_VALUE;
      DownBuffer[i] = EMPTY_VALUE;

      if(IsBullishEngulfing(i, open, high, low, close))
      {
      UpBuffer[i] = low[i] - (high[i] - low[i]) * 0.1; // Place the dot below the low of the engulfing bar
      if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
      {
      Alert(Symbol(), " ", Period(), " - Bullish Engulfing Pattern at bar ", i);
      }
      }

      if(IsBearishEngulfing(i, open, high, low, close))
      {
      DownBuffer[i] = high[i] + (high[i] - low[i]) * 0.1; // Place the dot above the high of the engulfing bar
      if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
      {
      Alert(Symbol(), " ", Period(), " - Bearish Engulfing Pattern at bar ", i);
      }
      }
      }

      return(rates_total);
      }
      //+------------------------------------------------------------------+
      //| Check if a bar is a bullish engulfing pattern |
      //+------------------------------------------------------------------+
      bool IsBullishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
      {
      if(close[index] > open[index] && close[index+1] < open[index+1]) // Check if the current bar is bullish and the previous bar is bearish
      {
      if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
      {
      return(true);
      }
      }

      return(false);
      }
      //+------------------------------------------------------------------+
      //| Check if a bar is a bearish engulfing pattern |
      //+------------------------------------------------------------------+
      bool IsBearishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
      {
      if(close[index] < open[index] && close[index+1] > open[index+1]) // Check if the current bar is bearish and the previous bar is bullish
      {
      if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
      {
      return(true);
      }
      }

      return(false);
      }

    • @AdamHarrisTrader
      @AdamHarrisTrader  9 месяцев назад

      //+------------------------------------------------------------------+
      //| Engulfing Candle Indicator.mq4 |
      //| Author: Bing |
      //| Description: This indicator will highlight engulfing candlesticks |
      //| on the chart and alert the user when they occur. |
      //+------------------------------------------------------------------+
      #property indicator_chart_window
      #property indicator_buffers 2
      #property indicator_color1 Blue
      #property indicator_color2 Red
      #property indicator_width1 2
      #property indicator_width2 2
      double UpBuffer[];
      double DownBuffer[];
      input int AlertPeriod = 0; // Set to 0 to disable alerts, or to a positive number to specify the number of bars to look back for engulfing patterns
      //+------------------------------------------------------------------+
      //| Initialization function |
      //+------------------------------------------------------------------+
      int OnInit()
      {
      SetIndexBuffer(0, UpBuffer);
      SetIndexStyle(0, DRAW_ARROW);
      SetIndexArrow(0, 108); // Dot code for blue buffer
      SetIndexBuffer(1, DownBuffer);
      SetIndexStyle(1, DRAW_ARROW);
      SetIndexArrow(1, 110); // Dot code for red buffer
      return(INIT_SUCCEEDED);
      }
      //+------------------------------------------------------------------+
      //| Deinitialization function |
      //+------------------------------------------------------------------+
      void OnDeinit(const int reason)
      {
      // Add any code that you want to execute when the indicator is removed from the chart
      }
      //+------------------------------------------------------------------+
      //| Calculation function |
      //+------------------------------------------------------------------+
      int OnCalculate(const int rates_total,
      const int prev_calculated,
      const datetime &time[],
      const double &open[],
      const double &high[],
      const double &low[],
      const double &close[],
      const long &tick_volume[],
      const long &volume[],
      const int &spread[])
      {
      int limit = rates_total - prev_calculated;
      for(int i = limit; i >= 0; i--)
      {
      UpBuffer[i] = EMPTY_VALUE;
      DownBuffer[i] = EMPTY_VALUE;
      if(IsBullishEngulfing(i, open, high, low, close))
      {
      UpBuffer[i] = low[i] - (high[i] - low[i]) * 0.1; // Place the dot below the low of the engulfing bar
      if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
      {
      Alert(Symbol(), " ", Period(), " - Bullish Engulfing Pattern at bar ", i);
      }
      }
      if(IsBearishEngulfing(i, open, high, low, close))
      {
      DownBuffer[i] = high[i] + (high[i] - low[i]) * 0.1; // Place the dot above the high of the engulfing bar
      if(AlertPeriod > 0 && i >= rates_total - AlertPeriod) // Check if alerts are enabled and if the pattern is within the alert period
      {
      Alert(Symbol(), " ", Period(), " - Bearish Engulfing Pattern at bar ", i);
      }
      }
      }
      return(rates_total);
      }
      //+------------------------------------------------------------------+
      //| Check if a bar is a bullish engulfing pattern |
      //+------------------------------------------------------------------+
      bool IsBullishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
      {
      if(close[index] > open[index] && close[index+1] < open[index+1]) // Check if the current bar is bullish and the previous bar is bearish
      {
      if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
      {
      return(true);
      }
      }
      return(false);
      }
      //+------------------------------------------------------------------+
      //| Check if a bar is a bearish engulfing pattern |
      //+------------------------------------------------------------------+
      bool IsBearishEngulfing(int index, const double &open[], const double &high[], const double &low[], const double &close[])
      {
      if(close[index] < open[index] && close[index+1] > open[index+1]) // Check if the current bar is bearish and the previous bar is bullish
      {
      if(low[index] < low[index+1] && high[index] > high[index+1]) // Check if the current bar engulfs the previous bar, including the wicks
      {
      return(true);
      }
      }
      return(false);
      }

    • @tshepomolaba1427
      @tshepomolaba1427 9 месяцев назад

      @@AdamHarrisTrader thank you!!🤞🙏

  • @pavmari1
    @pavmari1 10 месяцев назад

    Hi Adam, where is the video for MT5 indicator?