I am using the latest version of MC.Net Portfolio Trader (v12.0 R3) to trade across a range of equity symbols. And my observation is that sometimes, stop losses *do* get sent, sometimes they *don't* despite the fact that we are calling
Code: Select all
GenerateStopLoss()
So in my trading signal code, there is this:
Code: Select all
double stopLossLevel = StrategyInfo.AvgEntryPrice * Math.Abs(StrategyInfo.MarketPosition) * 0.01;
Output.WriteLine("stop loss @ {0}", stopLossLevel); // output: “stop loss @ 333.5919”
GenerateStopLoss(stopLossLevel);
Output.WriteLine("trailing from {0} profit", stopLossLevel); // output “trailing from 333.5919”
GeneratePercentTrailing(stopLossLevel, 50);
BUT: I have a position in my books that is -943.81$ so well beyond the point when the stop loss should have flattened it. However, I do not see a stop loss order on the “Orders” tab. Also, when I restart the system, the position stays untouched as well while I would expect it to get closed immediately. If have tried with "Optimize order flow" and without.
I have no clue if this behavior is caused by something similar to viewtopic.php?t=51602 or if I just don't understand how that stop loss should function in theory but it's certainly starting to drive me nuts. And I'm starting to just randomly guess what this could be caused by:
- I do have a MMS in place - could that thing somehow tamper with the stop loss orders that the signal generates?
- I always open my positions at the end of a trading day (about a minute before the exchange closes) so I'm wondering if it could be related to that.
- Or perhaps it's caused by the broker connectivity drops that happen once a night with Interactive Brokers and sometimes even during the day?
- Or is it perhaps because of an overnight price change where the next trading already starts at a price that is low enough to cause a loss of more than the stop loss amount and then there is no "transition" which could cause the stop loss or something?
- Or could it perhaps be because I have Max Potential Loss set to "0" (for whatever reason)? This appears to also explain (viewtopic.php?f=1&t=10522&p=51440&hilit ... tal#p51440) why I am getting a value of 0 when I use Portfolio.InvestedCapital btw. which is another strange and surprising thing that keeps bugging me.
- Or is it all because I do not have a base currency set?