Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
indicator jumps around ?
Collapse
X
-
indicator jumps around
The redline indicator shown in the attachments is a function of the previous bar open and close. Those open and close values never change, yet the last segment of the indicator jumps around as shown in the two attachments. Any comments or suggestions will be appreciated.
-
thanks Matthew
the indicator file is attached.
the code which creates the indicator is as follows:
if(BarsPeriod.Id == PeriodType.Day)//for day bars [don't use GetDayBar for day bars]
{
XXCloseyest=((Open[1]+High[1]+Low[1]+Close[1])*0.25);
XXOpen=((XXCloseyest+XXOpenyest)*0.5);
XXOpenyest=XXOpen; //this will be used on next bar, when at that time it will be XXOpenyest
}Attached Files
Comment
-
Hi Joemiller,
I'm not seeing any errors with the compile and code.
Are you seeing this with all your charts and instruments or just this one in particular?
I see you are using the Print() for your values, are they correct ones being plotted?
What are you setting the Calculate on Bar Close to?Cal H.NinjaTrader Customer Service
Comment
-
Originally posted by joemiller View Postthanks Matthew
the indicator file is attached.
the code which creates the indicator is as follows:
if(BarsPeriod.Id == PeriodType.Day)//for day bars [don't use GetDayBar for day bars]
{
XXCloseyest=((Open[1]+High[1]+Low[1]+Close[1])*0.25);
XXOpen=((XXCloseyest+XXOpenyest)*0.5);
XXOpenyest=XXOpen; //this will be used on next bar, when at that time it will be XXOpenyest
}Code:XXOpen=((XXCloseyest+XXOpenyest)*0.5); XXOpenyest=XXOpen; //this will be used on next bar, when at that time it will be XXOpenyest
Remember that OnBarUpdate(), while an event-handler, is at base, a loop construct. We often forget that the whole paradigm of event-driven programing is to process messages in either a loop, or based on an interrupt scheme.
Last edited by koganam; 08-26-2013, 06:40 PM.
Comment
-
damn, I don't have a clue what you said but, no matter, I do think it sounds like I may somehow be able to correct the issue by finding some way to preserve XXOpenyest. because I think I have to Keep COBC = false?
if you guys have any suggestions I will be eternally grateful.
Comment
-
Cal,
forgot to answer your questions.
Are you seeing this with all your charts and instruments or just this one in particular?
ALL CHARTS
I see you are using the Print() for your values, are they correct ones being plotted?
LOOKS LIKE THEY ARE THE SAME ... THE OUTPUT WINDOW KEEPS UPDATEING WITH INCOMING PRICE FEED.
What are you setting the Calculate on Bar Close to?
DIDN'T KNOW I SHOULD SPECIFY ANYTHNG BEYOND COBC = FALSE?Last edited by joemiller; 08-26-2013, 05:51 PM.
Comment
-
Joemiller,
You can set the indicator to calculate on bar close set to true when you first enable the indicator on the chart.
I will agree with Koganam that your variable is most likely getting reset over and over with the indicator set to false, thus causing the indicator to act the way you see it from the screenshots.
Let me know if I can be of further assistanceCal H.NinjaTrader Customer Service
Comment
-
CalculateOnBarClose is set false in the initialize region of the indicator to force last day display of the indicator.
do you mean I should set it to true ... because if I do I think the indictor will not be displayed on the last currently developing bar, which is what I need?
Comment
-
Originally posted by joemiller View Post
CalculateOnBarClose is set false in the initialize region of the indicator to force last day display of the indicator.
do you mean I should set it to true ... because if I do I think the indictor will not be displayed on the last currently developing bar, which is what I need?
Code:[B][SIZE=3][COLOR=#000000][FONT=Calibri]if(BarsPeriod.Id == PeriodType.Day)//for day bars [don't use GetDayBar for day bars] [/FONT][/COLOR][/SIZE][/B] [B][SIZE=3][COLOR=#000000][FONT=Calibri]{[/FONT][/COLOR][/SIZE][/B] [COLOR=Red][B]if (FirstTickOfBar) {[/B][/COLOR] [B][SIZE=3][COLOR=#000000][FONT=Calibri]XXCloseyest=((Open[1]+High[1]+Low[1]+Close[1])*0.25);[/FONT][/COLOR][/SIZE][/B] [B][SIZE=3][COLOR=#000000][FONT=Calibri]XXOpen=((XXCloseyest+XXOpenyest)*0.5);[/FONT][/COLOR][/SIZE][/B] [B][SIZE=3][COLOR=#000000][FONT=Calibri]XXOpenyest=XXOpen; //this will be used on next bar, when at that time it will be XXOpenyest[/FONT][/COLOR][/SIZE][/B] [COLOR=Red][B]}[/B][/COLOR] [B][SIZE=3][COLOR=#000000][FONT=Calibri]} [/FONT][/COLOR][/SIZE][/B]
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Waxavi, Today, 02:10 AM
|
0 responses
3 views
0 likes
|
Last Post
by Waxavi
Today, 02:10 AM
|
||
Started by TradeForge, Today, 02:09 AM
|
0 responses
8 views
0 likes
|
Last Post
by TradeForge
Today, 02:09 AM
|
||
Started by Waxavi, Today, 02:00 AM
|
0 responses
2 views
0 likes
|
Last Post
by Waxavi
Today, 02:00 AM
|
||
Started by elirion, Today, 01:36 AM
|
0 responses
4 views
0 likes
|
Last Post
by elirion
Today, 01:36 AM
|
||
Is it possible to have a drawing, such as a line, cycle through different colors?
by gentlebenthebear
Started by gentlebenthebear, Today, 01:30 AM
|
0 responses
4 views
0 likes
|
Last Post Today, 01:30 AM |
Comment