Storing order parameters in an array and placing said orders as pending orders later on
Your topic has been moved to the section: Expert Advisors and Automated Trading
MQL5 forum: Expert Advisors and Automated Trading
- www.mql5.com
How to create an Expert Advisor (a trading robot) for Forex trading
Hello everyone!
This is my first post here so please don't roast me too hard if I'm going against any conventions here. I'll try my best.
I'm currently trying to place pending orders using MqlTradeRequest. Since I can't seem to put MqlTradeRequest objects in an array I created a struct mirroring the needed MqlTradeRequest parameters which I can store in an array.
The function DefineOrders() is called in OnInit(). I also tested to call it after initialization to no avail.
Error code is 4756 and Journal Message reads: "failed sell 0.01 USDCHF at 0.95000 (0.00000) sl: 2.00000 tp: 0.94500 [Invalid request]" (once for every iteration over the array)
Since the error message displays all the correct values I'm fairly certain that all values are passed correctly from the array to the request object.
The following code snippet is just meant as a proof of concept and the values are arbitrary.I feel like I'm overlooking something completely obvious and will bang my head against the wall once pointed out. Thanks for your time!