Discussing the article: "OpenAI's ChatGPT features within the framework of MQL4 and MQL5 development" - page 3

 
Dmitry Fedoseev #:

This is the task of the EMA writer - to make all his subsequent calculations equal to the previous ones. It is not necessary to save up bars until you are blue in the face, but, as I wrote above, you only need 10-20 times more bars than the period.

About cycles is very convincing... Of course, there is absolutely no difference between a cycle of 10 bars and a cycle of 100 bars... Especially if you consider the existence of fast algorithms for calculating averages.

10 to 20 times? Why not 50 to 100? Or maybe 100-1000 ? How do you measure that? I understand what you're saying, but I'm not even interested in wasting my time arguing about it

 
Evgeniy Ilin #:

SymbolInfoDouble(_Symbol,SYMBOL_POINT) - this is how it should be. In general, you have understood... I'm the one who fixed most of the errors. I would have seen it all if it was the code for my ts. There are flaws... and if you don't know what you're doing, it's useless. You're on the right track. He's often wrong. There's a reason I wrote that article. I could make a super prompt, it would not make a mistake and give everything perfectly, but it would be useless because it's all a show. In real field conditions we ask simple human questions, which in the best case can be more specific, but as practice shows not much it reduces post processing.

No, smiled just)))) with fantasy error) and in this case for the current symbol can simply _Point)
 
Valeriy Yastremskiy #:
No, just smiled)))) with fantasy error) and in this case for the current symbol you can just _Point).

Well yes, I appreciated the joke ))). But God forbid you start making a multitool ))))

 
Evgeniy Ilin #:

10, 20 times? Why not 50 to 100? How about 100 to 1,000? How do you quantify that? I understand what you're saying, but I'm not even interested in wasting my time arguing about it

With your brain, mate, with your brain. I.e. it is necessary from the presence, first of all... and there, and then, and then, and interest will appear.

 
Dmitry Fedoseev #:

Use your brains, mate, use your brains. I.e. it is necessary to be available, first of all... and there, and then, you will see, and interest will appear.

You must be a very sensitive person. Perhaps I was wrong to make an emotional comment.

 


Thank you very much Evgeniy Ilin

This article perfectly outlines how to effectively use the AI technology in programming while also pointing out what to avoid.

 

I am the same as you, after using ChatGPT I have much more positive thoughts about it because it is very smart and fast.

 

"apply a technology for its intended purpose reduces both the cost of any development and labor costs"

This is also my objective

 

I need a MT5 Expert Advisor based on Bollinger Bands

Certainly! Here's an example of a MetaTrader 5 Expert Advisor (EA) based on Bollinger Bands. This EA buys when the price crosses below the lower Bollinger Band and sells when the price crosses above the upper Bollinger Band:


//+------------------------------------------------------------------+
//|                         BBExpertAdvisor.mq5                     |
//|                        Generated by Bing AI                       |
//+------------------------------------------------------------------+
#property copyright "Your Name"
#property version   "1.00"
#property script_show_inputs

// Bollinger Bands settings
input int      bbPeriod    = 20;
input double   bbDeviation = 2.0;
input double   lotSize     = 0.1;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
    Print("BBExpertAdvisor initialized.");
    return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
    // Declare variables for Bollinger Bands
    double upperBB, middleBB, lowerBB;

    // Calculate Bollinger Bands
    if (iBands(_Symbol, _Period, bbPeriod, bbDeviation, 0, 0, upperBB, middleBB, lowerBB) > 0)
    {
        // Get the current price
        double currentPrice = SymbolInfoDouble(_Symbol, SYMBOL_BID);

        // Buy condition: If the price crosses below the lower Bollinger Band
        if (currentPrice < lowerBB)
        {
            // Check if there are no open orders
            if (OrdersHistoryTotal() == 0 && OrdersTotal() == 0)
            {
                // Open a buy order
                OrderSend(_Symbol, OP_BUY, lotSize, currentPrice, 3, 0, 0, "Buy Order", 0, 0, Green);
            }
        }

        // Sell condition: If the price crosses above the upper Bollinger Band
        if (currentPrice > upperBB)
        {
            // Check if there are no open orders
            if (OrdersHistoryTotal() == 0 && OrdersTotal() == 0)
            {
                // Open a sell order
                OrderSend(_Symbol, OP_SELL, lotSize, currentPrice, 3, 0, 0, "Sell Order", 0, 0, Red);
            }
        }
    }
}
//+------------------------------------------------------------------+


This EA uses the `iBands` function to calculate the Bollinger Bands. Customize the Bollinger Bands settings (`bbPeriod` and `bbDeviation`) and risk management parameters (`lotSize`) according to your trading strategy.

Before deploying any EA in a live trading environment, it is essential to test it thoroughly on historical data and in a demo account to ensure its reliability and effectiveness.
 
I tried to get MT5 code but failed. It seems ChatGPT can only provide MT4 code