I am a long time programmer so I eventually figured out what was happening but a non-programmer would never in a million years have figured this one out.
I didn't want to have a long entry below a stop loss from an opposite side trade (obviously using the unmanaged approach), so I compared the two prices (the proposed entry vs. the existing stop loss).
1.2979 (a tick above a certain price) vs. 1.2979 (existing stop loss) expecting to find them equal and therefore, the entry would need to be moved up or not put out at all.
As I am sure you can guess by this point, they aren't necessarily equal even though they appear to be because they are both doubles (and come directly from NinjaTrader supplied prices with a multiple of TickSize added or subtacted).
Once I figured out what the issue was, I converted them both to integers and then did the compare. Does the documentation warn about this anywhere? My mistake but it didn't occur to me that I couldn't compare two numbers that come directly from OnExecution and see if they are equal.
No real issue from my end but thought it is something others might want to be aware of. Of course, I now have to go through every line of my code base looking to see if I repeated the error anywhere else.
Such is the life of a programmer.
Comment