LM Trader Setup

LM Trader Setup

3 October 2024, 01:42
Ahmed Ali
0
25


The first important step is to get the OpenAI API Key. OpenAi offers chat and api for their models. As you know the chat platform is in the browser which is called ChatGpt. The api however, used for any platform like your own web or tools. in our case, we need to use it in the EA.
Go to https://platform.openai.com/ then log in or register if you do not have an account.

Then go to Dashboard --> Usage --> scroll down to see limit and click increase limit.
You will be redirected to limits page like this:



click Buy credits then add payments details. OpenAi charges you per the consumed credits which are based on the requests. You can set maximum limit too.

then go back to Dashboard --> API Keys, then click create new key as



give it a name then click create secret key. Copy the key in save place like text file in your pc or directly to the EA input settings. 

Note: You should have added your payment details successfully before you can use the key. 

Now in the Meta trader 5 terminal, go to Tools --> Options then check on the Allow WebRequest and add the following link: 

(see the image below)



Now The EA settings:

LM TRADER Settings

1- API key: it is the OpenAi key you got from the previous steps, it normally starts with "sk-".


2- Model selection: the default is the best for the quality and the cost, please check https://openai.com/api/pricing/ for full details.

3- Custom Trading Instructions: This is the most important field where you should not put it empty otherwise the gpt will be trading with the default instructions. The instruction is the prompt you enter to tell the gprt everything about your trading strategy. you can tell it anything basically, from how to make trade to how make the stop loss and take profit.


4-  Custom Trade Modification Instructions: it is optional but it is better to tell the gpt how to deal with the open trades, like cutting the loss fast or making trail most of the time, etc..


5- Minimum Volume: here you specify the minimum lot size for trading.

6- Maximum Volume: the maximum lot size that can be traded. The gpt will be aware of the volume range so it can trade according to how strong the signal is.

7-  Maximum Number of Open Trades: It is clear, the EA should not open more than this number.

8- Trade comment: To make know the trades made by LM TRADER when looking into the history.

9- Open Trades Check Interval: This interval in minutes, the gpt checks your open trade and decide to react or not based on the market. If you have modification instructions, it should adhere to that when checking on trades.

10- Enable News Knowledge: if enabled (True), the news will be fed to the gpt for any each candle open. If False, the EA will not be aware of the news for today. 


11- News Country code: for example, if you are trading gold (XAUUSD) you would type US as it is most relevant effect. This will give the EA all the news events happing today.  Each event has the time, title, importance (low, medium, high), the actual, forecast and previous numbers. The EA should correlate to each of these events if thinks it is big deal.

12- Trading Hours (GMT): specify the trading hours if you want. The EA should trade only in these hours. The time is in GMT which might be different from the broker time. The news and the history logs are all in broker time though.

13- Enable AI Agents: if set to true, each time there will be AI agents who make the analysis and brainstorming. AI Agents is one of AI threat to humanity but we are using it here for our benefits. The good thing is that, there is no individual decision by gpt but rather multiple analysis where the final agent will decide based on the first agents suggestions.

14- Agent Final Risk Level:  set the risk level for the final AI decision  on the trade. If you set it High, the final AI agent might ignore holding trade suggestion if he thinks the other agents are not taking enough risk. 


Things to Note:

1- Do not forget to enable auto trading.

2- Although agents are powerful, be aware that they make three api requests in each candle open to decide if they need to open a trade.

3- Your AI gpt or the agents are always looking for your trading instructions and they make them into considerations in their analysis. If you do not provide instructions, the gpt will rely on its knowledge to analyze the market.


4-  You can check the full EA logs under data folder through  MQL5/Files/LM_TRADER_Log.txt file.