I am hoping one of the programmers here can solve this (for me) tricky programming problem. It is a variable hidden SL and/or TP depending on why I entered the trade.
Here is the situation:
1. This is a scalping EA I am working on so my SL and/or TP will be very tight which must be hidden as most dealers STOP_LEVEL will not allow an OrderModify at my SL or TP level (causing a OrderModify error 130) or worse, a no close on my other closing criteria because the OrderModify did work and now won't close because it is TOO CLOSE TO MARKET. I really hate Dealers that have this restriction programmed into their Dealing Desk MT4. How many ways they have to screw you!! I m hoping this programers question will help this.
2. I am opening up to 5 progressive simultaneous trades (only one per bar) based on 4 different ENTRY criteria on a 15M chart. Therefore each bar will have a potentially new entry criteria (therefore a new TP or SL calculation).
3. Based on the criteria of the entry, I want to tie a unique hidden SL and/or TP to each separate open trade (Ticket Number) and retain that to be part of the other close procedures criteria for that particular trade (Ticket No.)
For example, one of my particular opens is based on RSI (among three other open criteria - CCI for example). For this particular open trade, I want to define my TP and my SL for this TICKET based on the previous Fractal High value and the previous Fractal Low value - AT THE TIME OF THE OPEN OF THIS PARTICULAR TRADE.
I need to carry these unique SL and TP values relative to THIS PARTICULAR OPEN TRADE over time to my CLOSE criteria for this particular trade (which will include this SL and TP plus other current TP and SL criteria defined elsewhere). In other words, the original calculated SL and/or TP will be part of my Closing routine. If those original SL's or TP's overrides my other criteria, that order (Tickent No.) should close.
I hope this is clear. If I use variables, if my MT4 platform goes down, I loose these SL's and TP's. If I use Global Variables, I could end up with thousands of Global Variables over time for all the open trades over time.
Any questions or ideas on how I can do this would be appreciated.
Thanks.
Here is the situation:
1. This is a scalping EA I am working on so my SL and/or TP will be very tight which must be hidden as most dealers STOP_LEVEL will not allow an OrderModify at my SL or TP level (causing a OrderModify error 130) or worse, a no close on my other closing criteria because the OrderModify did work and now won't close because it is TOO CLOSE TO MARKET. I really hate Dealers that have this restriction programmed into their Dealing Desk MT4. How many ways they have to screw you!! I m hoping this programers question will help this.
2. I am opening up to 5 progressive simultaneous trades (only one per bar) based on 4 different ENTRY criteria on a 15M chart. Therefore each bar will have a potentially new entry criteria (therefore a new TP or SL calculation).
3. Based on the criteria of the entry, I want to tie a unique hidden SL and/or TP to each separate open trade (Ticket Number) and retain that to be part of the other close procedures criteria for that particular trade (Ticket No.)
For example, one of my particular opens is based on RSI (among three other open criteria - CCI for example). For this particular open trade, I want to define my TP and my SL for this TICKET based on the previous Fractal High value and the previous Fractal Low value - AT THE TIME OF THE OPEN OF THIS PARTICULAR TRADE.
I need to carry these unique SL and TP values relative to THIS PARTICULAR OPEN TRADE over time to my CLOSE criteria for this particular trade (which will include this SL and TP plus other current TP and SL criteria defined elsewhere). In other words, the original calculated SL and/or TP will be part of my Closing routine. If those original SL's or TP's overrides my other criteria, that order (Tickent No.) should close.
I hope this is clear. If I use variables, if my MT4 platform goes down, I loose these SL's and TP's. If I use Global Variables, I could end up with thousands of Global Variables over time for all the open trades over time.
Any questions or ideas on how I can do this would be appreciated.
Thanks.