1. Welcome back! Thank you for being a part of this Traders Community. Let's discuss and share :)
    Selamat datang kembali! Trimakasih telah menjadi bagian dari Komunitas Trader ini. Mari berdiskusi dan berbagi :)
    Dismiss Notice

New EA GOLD EA with AI

Discussion in 'Expert Advisor atau Robot Forex' started by sebimt301, 31 Dec 2024 at 17:21.

Tags:
  1. sebimt301

    sebimt301 New Member

    Equity
    Credit
    Ref Point
    Hello Everyone,

    I have a strategy in my mind and I would like to try and test it. I always liked the support and resistance level for the the trading. That's why I made an EA with supdem indicator and try to pair with AI like Cynera.
    The strategy works fine but need the EA decision as well. The problem is the function of webrequest.

    Plase help me to fix this this problem. I always got this error: API Request failed. Error= 4051, HTTP Code= -1

    I tested the json request via Postman and works fine, so I think the problem in MT4 but I tried everything and I do not have new idea.

    Thank you for your help!
     

    Attached Files:

  2. yohmi

    yohmi Member Credit Hunter

    Equity
    Credit
    Ref Point
    5/5,
    This is my review for this thread:
    It's a great attempt.
     
  3. evil twins

    evil twins Member Credit Hunter

    Equity
    Credit
    Ref Point
    The error "API Request failed. Error= 4051, HTTP Code= -1" indicates that the request via WebRequest did not reach the OpenAI API server. The reason is most likely related to MetaTrader platform or network settings.
     
  4. evil twins

    evil twins Member Credit Hunter

    Equity
    Credit
    Ref Point
    The message that appears in response to the following link https://api.openai.com/v1/chat/completions
    It means that you did not send the API Key required in the request. This key is what gives you the authority to use OpenAI services
     
  5. sebimt301

    sebimt301 New Member

    Equity
    Credit
    Ref Point
    I send the neccessery keys. I mean API key and org-id. If I test the json request with externel tool, like Postman working fine. So I need that check somebody if have more experience about MQL promming like me. Please, someone help me because I want to test if my idea works, and I can't calm my mind until I see the result. :)
     
  6. evil twins

    evil twins Member Credit Hunter

    Equity
    Credit
    Ref Point
    curl -X POST "https://api.openai.com/v1/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
    -d '{
    "model": "gpt-4",
    "messages": [{"role": "user", "content": "Hello"
    }]
    }'


    If test it via Postman ..and don't get error

    You need other function of webrequest
     
  7. evil twins

    evil twins Member Credit Hunter

    Equity
    Credit
    Ref Point
    I am trying to understand your strategy but I couldn't. All I understood from the code is that you are using an api key to filter the trades that the indicators give you.... Here are some points. First, you will need to improve the performance of the code and handle errors in a better way. You can add additional procedures to check the response and handle errors. Since the data is fetched every 30 minutes, it will take time.... I wanted to help, but since you don't know anything about coding, it will make it a bit difficult.
     
  8. LuigiM2604

    LuigiM2604 Member Credit Hunter

    Equity
    Credit
    Ref Point
    Ogni 30 minuti l'EA invia i dati del mercato (RSI, ATR, e MA) all'API di OpenAI per ricevere una decisione ("BUY", "SELL" o altro).
     
  9. sebimt301

    sebimt301 New Member

    Equity
    Credit
    Ref Point
    Thank you for your help! Currently everything in printing mode because of debug. Yes I am not a professional developer that's why what I need help. I need only the webruest function. So the callapi() section. Every parameters looks good and still dows not work. I think some little syntax or slt the probelm.
    Thank you!
     

Share This Page