PDA

View Full Version : Custom types and AddBar method


cls71
10-06-2009, 04:59 AM
I am doing a port of a custom type which calculates the bid-ask pressure. The value of the pressure may be positive, negative or zero.
I was using the field volume to save the pressure value.
This custom type works perfectly in NT 6.5.
However, in NT 7.0 doesn't work. Looks like if NT recalculates the field Volume when is less than zero.

In this example just at moment before the AddBar is executed, the last bar of the serie has a volume value = -1000. It's correct.


http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=7194&stc=1&d=1254822581

However, when the AddBar sentence is executed, the volume of the previous bar is modified.

http://www.ninjatrader-support2.com/vb/attachment.php?attachmentid=7195&stc=1&d=1254822581


I don't know if this is a bug or an internal prohibition of NT.

For testing this issue I have coded a custom type like the Volume standard type, which assign -1000 to all bars.
(Would be like the volume type with period type = 1000, but negative).

All bars show a volume = 24.
If the period value = -5000, then all bars show a volume = 120 ( 24x5)

Thanks.

NinjaTrader_Dierk
10-06-2009, 05:17 AM
Yesterday we came across an issue related to bars building which "shows it's ugly head" at index values which are a multiple of 128. The result would be unexpected OHLCVT values after adding a bar.

Point being: we are looking into that right now. However, it would take until next week as our expert would be back.

Sorry for the inconvenience...

NinjaTrader_Dierk
10-12-2009, 07:31 AM
We're looking into that issue right now. Although we uncovered a bug, it's not the issue you're experiencing.

Your issue is the negative volume: unfortunately this is not supported by NT7.

cls71
10-12-2009, 11:19 AM
Hello Dierk,

Internally, somehow, NT modifies this value when negative.
In the previous version did not. And I could use the field volume to store a different value to the volume.

If this is the correct behavior of NT7, then it is not a bug.

However it is a strange behaviour. A field of type LONG admits negative values. Why override it to 24 and not reset or initialize?

Best regards

NinjaTrader_Dierk
10-12-2009, 12:05 PM
Negative volume values never had been supported by NT. If it worked for you on NT6.5 then this was not intended (and I'm sorry if this guided you to the wrong direction) nor could you expect it to be working on future versions.