- The code you posted is MT4. You are using MT5. Translate it. MT4 only has orders. On MT5 orders are pending. Open orders are positions. Learn the language.
- You are incrementing variables, where do you initialize your counts to zero before entering the loop?
Thank you both for your posts! @Tobias Johannes Zimmer @Fabio Cavalloni
I tried opening a thread yesterday with the whole code but because I tried to work this out for myself and the inputs came from ChatGPT, I guess it got flagged by a moderator. I have my TakeProfit, StopLoss, MaximumBuyOrders and MaximumSellOrders inputs first and then my global variables include my buyOrders and sellOrders variables as a way to keep count of how many positions I have open.
Then, because of the compile errors, I tried explicitly defining OrderCloseTime and OrderType in the following code, I even tried explicitly defining the OrderSelect function:
// Declare constants explicitly #define SELECT_BY_POS 1 #define MODE_TRADES 1 #define OP_BUY 0 #define OP_SELL 1 #define OrderCloseTime() OrderCloseTime #define OrderType() OrderType #define OrderProfit() OrderProfit // Function declarations bool OrderSelect(int index, int select, int pool = MODE_TRADES); int OrderSend( string symbol, int cmd, double volume, double price, int slippage, double stoploss, double takeprofit, string comment = "", int magic = 0, datetime expiration = 0, color arrow_color = clrNONE );
I'm nervous to post the whole code incase it gets flagged up again. I think AI is a fantastic resource to learn from but I am trying to learn this coding language for myself and it's difficult to get help here if posts get taken away. I understand the forum has probably been flooded by mindless AI drivel though.
@Fabio Cavalloni
How do you 'count' the number of long/short trades you currently have open? If I could just reset buyOrders and sellOrders then do a quick 'count' at the start of every new tick then this would make things a lot more efficient; I imagine this should be quite common with risk considerations in EA bots. Could you explain how I would achieve this please? I only want the bot to not place any more buy orders if there are X amount already open and same with sell orders.
Thank you,
CPerry.
- The code you posted is MT4. You are using MT5. Translate it. MT4 only has orders. On MT5 orders are pending. Open orders are positions. Learn the language.
- You are incrementing variables, where do you initialize your counts to zero before entering the loop?
Ahhhhhh I don't know what I don't know clearly. I'll look into translating into MT5. The learning resources I have used previously must have been outdated. Thank you for nudging me in the right direction.
Stop using ChatGPT.
Help needed to debug and fix an AI EA - Trading Systems - MQL5 programming forum #2 (2023)
Thank you both for your posts! @Tobias Johannes Zimmer @Fabio Cavalloni
I tried opening a thread yesterday with the whole code but because I tried to work this out for myself and the inputs came from ChatGPT, I guess it got flagged by a moderator. I have my TakeProfit, StopLoss, MaximumBuyOrders and MaximumSellOrders inputs first and then my global variables include my buyOrders and sellOrders variables as a way to keep count of how many positions I have open.
Then, because of the compile errors, I tried explicitly defining OrderCloseTime and OrderType in the following code, I even tried explicitly defining the OrderSelect function:
I'm nervous to post the whole code incase it gets flagged up again. I think AI is a fantastic resource to learn from but I am trying to learn this coding language for myself and it's difficult to get help here if posts get taken away. I understand the forum has probably been flooded by mindless AI drivel though.
@Fabio Cavalloni
How do you 'count' the number of long/short trades you currently have open? If I could just reset buyOrders and sellOrders then do a quick 'count' at the start of every new tick then this would make things a lot more efficient; I imagine this should be quite common with risk considerations in EA bots. Could you explain how I would achieve this please? I only want the bot to not place any more buy orders if there are X amount already open and same with sell orders.
Thank you,
CPerry.
Chat GPT wil not code an expert for you. It can be used for small projects like giving you ideas on how to code certain functions. But using it to write you a complete EA will not work. Ai is clever, but not yet clever enough. It will be better to use some EA generator that can be found on google, the chances that you will have code errors are there, but drastically low
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good morning Forum,
I have an EA that currently has two variables: buyOrders and sellOrders which increase by 1 each time a new trade is made. I have a maximum number limit which is currently set at 10 buys and 10 sells simultaneously. If a trade closes, then I would like these variables to decrease by 1 but I keep getting compile errors (bottom of this message) and I could do with somebody explaining to me why this is and how to fix it, please.
Compile Errors:
'OrderCloseTime' - undeclared identifier FTMO Challenge (4 Candles + Closing).mq5 153 17
'OrderType' - undeclared identifier FTMO Challenge (4 Candles + Closing).mq5 160 21
'OrderType' - undeclared identifier FTMO Challenge (4 Candles + Closing).mq5 164 26
Thank you,
CPerry.