
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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!