Ok, I was thinking some more last night and think I can still use your first bit of code to do what I want.
How do I set it to make sure when it's checking the orders to start from the first to the last?
Then I can check the first order how many pips it is in the negative and if in recovery Mode (Current price - OrderOpenPrice > Point*ReEntryLinePips) then if Orders Open > 1 then First order check complete = true, so must be on the second order now, if Current price - OrderOpenPrice > Point*ReEntryLinePips = true, Second order is in need of Recovery, etc ...
Logic needs to be refined a bit but I think I can work with that.
Thanks for the help.
Order tracking
- gaheitman
- Trader
- Posts: 655
- Joined: Tue Nov 15, 2011 10:55 pm
- Location: Richmond, VA, US
Re: Order tracking
When you iterate through the list, start with i=0, that makes sure you are going through the list in the order they were entered.
To be honest, I wouldn't approach the problem like that. I wouldn't try to monitor each individual recovery trade, I'd only want to know how many trades I have in a currency and what the first one is.
For example, lets assume we are trading EURUSD and we just entered the trade based on our underlying strategy. Let's assume if the trade goes against us 100 pips we want to enter a recovery trade, and continue to enter recovery trades every 100 pips until we've entered 4 recovery trades. So, for the first recovery trade we compare our initial trade's OrderOpenPrice with the bid. If the trade goes against us by 100 pips, we know to enter our first recovery trade. That's pretty much the same either way. Now I am suggesting we ignore the first recovery trade and continue to monitor the initial trade. When it goes against us by 200 pips, we know to enter another recovery trade. We can either keep track of the next threshold by adding it to our initial threshold (first it's equal to 100 pips, and then we add another 100 after entering the first recovery trade, etc.), or we simply monitor the number of trades. As you can see, the pip threshold we are looking for the initial trade to pass is equal to PipThreshold*CountOpenTradesByPair("EURUSD"). Each time it passes that we want to enter another trade until CountOpenTradesByPair("EURUSD") = MaxRecoveryTrades+1
OK, my ramblings have no doubt ceased to be helpful. It's the turkey leftovers.
Let me know if you want to see what int CountOpenTradesByPair(string ccy) and
double CalcProfitByPair(string ccy) might look like. For that matter int GetFirstOpenTradeByPair(string ccy) might be helpful too.
George
To be honest, I wouldn't approach the problem like that. I wouldn't try to monitor each individual recovery trade, I'd only want to know how many trades I have in a currency and what the first one is.
For example, lets assume we are trading EURUSD and we just entered the trade based on our underlying strategy. Let's assume if the trade goes against us 100 pips we want to enter a recovery trade, and continue to enter recovery trades every 100 pips until we've entered 4 recovery trades. So, for the first recovery trade we compare our initial trade's OrderOpenPrice with the bid. If the trade goes against us by 100 pips, we know to enter our first recovery trade. That's pretty much the same either way. Now I am suggesting we ignore the first recovery trade and continue to monitor the initial trade. When it goes against us by 200 pips, we know to enter another recovery trade. We can either keep track of the next threshold by adding it to our initial threshold (first it's equal to 100 pips, and then we add another 100 after entering the first recovery trade, etc.), or we simply monitor the number of trades. As you can see, the pip threshold we are looking for the initial trade to pass is equal to PipThreshold*CountOpenTradesByPair("EURUSD"). Each time it passes that we want to enter another trade until CountOpenTradesByPair("EURUSD") = MaxRecoveryTrades+1
OK, my ramblings have no doubt ceased to be helpful. It's the turkey leftovers.
Let me know if you want to see what int CountOpenTradesByPair(string ccy) and
double CalcProfitByPair(string ccy) might look like. For that matter int GetFirstOpenTradeByPair(string ccy) might be helpful too.
George
matrixebiz wrote:Ok, I was thinking some more last night and think I can still use your first bit of code to do what I want.
How do I set it to make sure when it's checking the orders to start from the first to the last?
Then I can check the first order how many pips it is in the negative and if in recovery Mode (Current price - OrderOpenPrice > Point*ReEntryLinePips) then if Orders Open > 1 then First order check complete = true, so must be on the second order now, if Current price - OrderOpenPrice > Point*ReEntryLinePips = true, Second order is in need of Recovery, etc ...
Logic needs to be refined a bit but I think I can work with that.
Thanks for the help.
-
matrixebiz
- Trader
- Posts: 70
- Joined: Wed Nov 16, 2011 4:39 am
Re: Order tracking
Hi, ReEntryLinePips=100, I thought about doing that to in needing to monitor the Original order but the Recovery System isn't straight Martingail so if my Recovery order is set to trigger at -100 pips and if the trade trigger conditions are not met then there will not be a Recovery order sent so a Recovery order may actually get triggered if conditions are right at -150 pips of Original order, then the next Recovery order will look to trigger at around the Second order -100 if Trade conditions are met, so in essence the Second Recovery order may be actually be initiated -300 pips of original order, not precisely at -200.
See the issue here of actually needing to keep track of the Recovery Orders directly not just monitoring the Original order -2*ReEntryLinePips
So, yes, might be interested in your other option if you feel like teaching me
but I think I can still work with your Original Code and rethink the logic a little with the Recovery System, maybe. Thanks
See the issue here of actually needing to keep track of the Recovery Orders directly not just monitoring the Original order -2*ReEntryLinePips
So, yes, might be interested in your other option if you feel like teaching me