PDA

View Full Version : Variable rounded


Richard Von
08-02-2007, 04:20 PM
I coded the attached indicator which has two inputs, Upper and Lower, each set to .03. When applied to a chart, the indicator window shows them at that value.

But the indicator doesn't work. To debug, I print the values to the Output Window which shows that both upper and lower or Upper and Lower are rounded to 1 -- which throws everything out of range.

I'm pretty sure that the double data type allows for the .03.

What's changing this?

ALSO: My square now print in the price window. Is there a way to make them print in the MACD window?

Thanks.

Gumphrie
08-02-2007, 04:50 PM
Two things:

1. Your public variables in the properties section are ints not doubles.

2. You have "Math.Max(1, value)" in the properties section which will always round the number up to at least 1.

The other problem:

All draw objects will output to the price window unless you specify 'DrawOnPricePanel' to false in Initialize() (as I mentioned earlier).

Richard Von
08-03-2007, 06:36 AM
Thanks. The Math.Max setting was done automatically by the NinjaTrader code generator. But I changed the settings of those and the function works fine.

Thanks also for the panel info. I must have missed it in your posts to others.

Thanks so much.

NinjaTrader_Ray
08-03-2007, 06:55 AM
The wizard does allow you to set a "double" type input instead of integer.