Was wondering if someone could figure out a solution for the below virtual trailing stop. Just to caveat I am also very new to coding!
The idea here is when a trade is opened, the Ask and Bid are used to stamp the highest high (TicketHighLow[i][3]) and lowest low made (TicketHighLow[i][2]) after OrderOpenTime. Once the TrailingStartGap is reached, and the price retraces to the TrailingStop, the order is closed.
The requirements are that the Virtual Trailing Stop should have the ability to trail each multiple orders open at the same time based on the OrderTicket, but also filter based on the OrderMagicNumber.
The problem with the below code is that when multiple orders are opened, the way that I am stamping the tickets and resizing the array (I believe) causes a mismatch between the OrderTicket and the HighestHigh and LowestLow in the Array. In other words;
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Was wondering if someone could figure out a solution for the below virtual trailing stop. Just to caveat I am also very new to coding!
The idea here is when a trade is opened, the Ask and Bid are used to stamp the highest high (TicketHighLow[i][3]) and lowest low made (TicketHighLow[i][2]) after OrderOpenTime. Once the TrailingStartGap is reached, and the price retraces to the TrailingStop, the order is closed.
The requirements are that the Virtual Trailing Stop should have the ability to trail each multiple orders open at the same time based on the OrderTicket, but also filter based on the OrderMagicNumber.
The problem with the below code is that when multiple orders are opened, the way that I am stamping the tickets and resizing the array (I believe) causes a mismatch between the OrderTicket and the HighestHigh and LowestLow in the Array. In other words;
TicketHighLow[i][1],TicketHighLow[i][2],TicketHighLow[i][3]
becomes something like
TicketHighLow[h][1],TicketHighLow[i][2],TicketHighLow[i][3]
The result is a trade opened and closed instantly.
Any ideas on how to get around this would be massively appreciated!