Did you copy the same format for your indicator (series added to Inititialize?)
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Multi Timeframe and Method Name Expected
Collapse
X
-
Indicator issue
Hi Ryan, yes exactly the same from strategy to indicator. I've this many times before with no problem. It compiles ok. The problem is the bars wont paint as an indicator but is ok as a strategy. Is it possible for you to can try it. If you paste in that code and see if you can get any bars to paint?
Cheers
DJ
Comment
-
I get this message when trying to run:
10/29/2010 4:05:04 PM Default Error on calling 'OnBarUpdate' method for indicator 'dj' on bar 0: You are accessing an index with a value that is invalid since its out of range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
You need current bar and current bars checks to make sure you aren't accessing invalid bars.
The series you are accessing are range, so this number can vary based on how many bars it takes to form compared to the primary series.
if (CurrentBar < x) return;
You'll have to experiment with values for x until you find one that works for you. I used a value of 20 which worked with ES and 1 minute bars.Ryan M.NinjaTrader Customer Service
Comment
-
Perfect..
Thanks Ryan, that worked perfectly! I also applied that to another problem one and it resolved that as well. I do have another odd one though which has me stumped. What I'm trying to do is to alert a hammer bar (small body big tail on a candle. I am using the code below on 50 cent range bars. So what it says is draw a triangle if the difference between the open and close is less that 20 cents, The problem is it doesn't work and gives the ones above 20 cents as well. Now if I put it like this
if ((Close[0] - Open[0])> .4) it does it correctly and gives me only this ones with 0.4 or above. So any idea why it works for above 0.4 but doesn't work on one less than 0.2? Thanks. DJ
Code:
// Condition set 1
if ((Close[0] - Open[0])< .2)
{
DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0] + -15 * TickSize, Color.Lime);
}
Comment
-
Dots issues
Thanks Kyle, I have another one here. Still working on it. Please find attached a chart and you will see small circles under/over the bars. I achieve this with the following code:
DrawDot("MyArrowDown"+CurrentBar, false, 0, Low[0] -Tickamount*TickSize, Color.White);
The problem is it's hard to see what is going on and would prefer to see the circles in a single row say plotting it at a price of 700 if the dots are under the bar and say 710 if they are above the bar.
Cheers
DJ
Comment
-
The only object we have that can stay in a fixed position is DrawTextFixed(). The other objects require a Y value. You can specify a y value or make it relative to OHLC bars. Unfortunately there is no supported way of drawing according to the relative position on the Y Axis.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Belfortbucks, Today, 09:29 PM
|
0 responses
3 views
0 likes
|
Last Post
by Belfortbucks
Today, 09:29 PM
|
||
Started by zstheorist, Today, 07:52 PM
|
0 responses
7 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
150 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
6 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
Comment