PDA

View Full Version : statements ignored


Burga1
06-30-2008, 02:16 PM
Greetings,

I'm wondering if there is something wrong with the syntax of the following command statement:

if(High[0] >= Fibo27(1.27, 1, 8, 1).Upper27[1]){do something}

Basically the idea is that if current price tops the last bar "Upper27" value from the "Fibo27" indicator something is to be done...this statement and others like it seem to be ignored by my strategy, and I'm at a loss to explain why? They seem to be ignored because the "do something" part is never done...ideas? Suggestions?

NinjaTrader_Ray
06-30-2008, 02:19 PM
Looks fine to me although you reference 1 bar ago for the Upper plot, you might want to make sure that you are not calling this when CurrentBar == 0 since you will get index out of range exception in your log.

Burga1
06-30-2008, 02:27 PM
Thanks, but it cannot be called on CurrentBar 0 because the strategy will not run until bar 20...so nothing seems wrong, huh?

NinjaTrader_Ray
06-30-2008, 02:32 PM
Syntax wise, it's fine.

Burga1
06-30-2008, 03:26 PM
Thank you. I think I found the problem however I'm at a total loss to explain it. If you check the attached screenshot you can see the values in question being reported incorrectly in the Output Window compared to the "Data Box" values. The Data Box contains the correct values. As can be seen, the strategy Print statements showing in the Output Window are correct for the High[1], Low[1], and Close[1]...but the values for "Fibo27" (the last 4 values in the Data Box) are completely off...

I have repeated this test using ONLY the "Fibo27" indicator running without the strategy, and the values that show in the Output Window then are completely correct...thus the strategy is somehow returning the incorrect values for that indicator. Could this be a possible bug? Or what could be the problem cause here??

mrlogik
06-30-2008, 09:24 PM
Burga1,

I'm having a similar problem in which Ray is looking into. The indicator I created shows the values correctly, yet when the same function is used within a strategy it does not calculate properly. Maybe that's your issue?

Anthony

NinjaTrader_Josh
06-30-2008, 09:58 PM
Why are you printing [1] values? The data box shows [0] values not [1] values.

Burga1
06-30-2008, 10:30 PM
The values in the Data Box are for [1] values, I hovered the cursor over that bar and held it there on that bar to bring up those values.

NinjaTrader_Josh
06-30-2008, 10:36 PM
I do not know where you are hovering. If you are hovering 1 bar behind the latest bar (a.k.a. the last bar that has the indicator plotted) that is still [0] index. What can help is add Time[0] into your print functions to make more sense of the raw information being printed.