TOI = Time[0].AddDays(-1); barsAgo=GetBar(new DateTime(TOI.Year,TOI.Month,TOI.Day,16,30,00)); SubjBar = HighestBar(High,barsAgo); HighPrice = High[SubjBar]; SubjBar = LowestBar(Low,barsAgo); LowPrice = Low[SubjBar]; OpenPrice = Open[barsAgo]; H90.Set(((HighPrice-OpenPrice) * .90)+OpenPrice); H78.Set(((HighPrice-OpenPrice) * .78)+OpenPrice); H62.Set(((HighPrice-OpenPrice) * .618)+OpenPrice); H50.Set(((HighPrice-OpenPrice) * .50)+OpenPrice); H38.Set(((HighPrice-OpenPrice) * .382)+OpenPrice); H22.Set(((HighPrice-OpenPrice) * .22)+OpenPrice); H10.Set(((HighPrice-OpenPrice) * .10)+OpenPrice); L10.Set(((OpenPrice-LowPrice) * .10)+LowPrice); L22.Set(((OpenPrice-LowPrice) * .22)+LowPrice); L38.Set(((OpenPrice-LowPrice) * .382)+LowPrice); L50.Set(((OpenPrice-LowPrice) * .50)+LowPrice); L62.Set(((OpenPrice-LowPrice) * .618)+LowPrice); L78.Set(((OpenPrice-LowPrice) * .78)+LowPrice); L90.Set(((OpenPrice-LowPrice) * .90)+LowPrice);
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
Code block "inhibits" indicator
Collapse
X
-
Code block "inhibits" indicator
This code block functions perfectly, unfortunately any indicator I use it in can no longer be referenced for public vars!
Code:Last edited by Sleeping Troll; 04-07-2010, 01:23 PM.Tags: None
-
Sleeping Troll,
Suggest you break it down further. Find the exact line in question. You should also try looking for conflicts in your variable names. And based on your prior posts with how you are making variables public, I wouldn't suggest making them public in that fashion. Instead I would recommend you keep everything private and just expose properties for the variables you wish to have accessible. Please see this reference demonstrating this concept: http://www.ninjatrader-support2.com/...ead.php?t=4991Josh P.NinjaTrader Customer Service
-
This is where it crashes.
Code:TOI = Time[0].AddDays(-1); barsAgo=GetBar(new DateTime(TOI.Year,TOI.Month,TOI.Day,16,30,00)); SubjBar = HighestBar(High,barsAgo); HighPrice = High[SubjBar]; SubjBar = LowestBar(Low,barsAgo); LowPrice = Low[SubjBar]; OpenPrice = Open[barsAgo]; [COLOR=Red]H90.Set(((HighPrice-OpenPrice) * .90)+OpenPrice);[/COLOR] // H78.Set(((HighPrice-OpenPrice) * .78)+OpenPrice); // H62.Set(((HighPrice-OpenPrice) * .618)+OpenPrice); // H50.Set(((HighPrice-OpenPrice) * .50)+OpenPrice); // H38.Set(((HighPrice-OpenPrice) * .382)+OpenPrice); // H22.Set(((HighPrice-OpenPrice) * .22)+OpenPrice); // H10.Set(((HighPrice-OpenPrice) * .10)+OpenPrice); // L10.Set(((OpenPrice-LowPrice) * .10)+LowPrice); // L22.Set(((OpenPrice-LowPrice) * .22)+LowPrice); // L38.Set(((OpenPrice-LowPrice) * .382)+LowPrice); // L50.Set(((OpenPrice-LowPrice) * .50)+LowPrice); // L62.Set(((OpenPrice-LowPrice) * .618)+LowPrice); // L78.Set(((OpenPrice-LowPrice) * .78)+LowPrice); // L90.Set(((OpenPrice-LowPrice) * .90)+LowPrice);
Originally this block was being accessed via an indicator which plotted a diagram, I will probably return to that scenario if I can ever figure out why that simple line of code keeps any indicator from sharing any values.Last edited by Sleeping Troll; 04-07-2010, 02:39 PM.
Comment
-
When I initially encountered the problem I tried assigning the dataseries values to statics. I must reiterate that the presence of this code disables access to all publics, even the ones I could previously access.
Comment
-
-
I have tried them as static vars and as dataseries... Regardless if they are correct or not if they do not create an error why would previosly accessible values not be accessible any longer!
Comment
-
Sleeping Troll,
It has to do with some relationship in your code that only you can debug. Unfortunately all I can do is tell you areas of interest which raise red flags in my eyes. You can try for yourself with a single exposed parameter and a DataSeries. Setting a value to a DataSeries would not cause the exposed parameter to be inaccessible. This is what the reference sample I linked you to earlier does and all exposed parameters were still accessible despite setting values to a BoolSeries.
What I would suggest is to strip it all down to a single variable and a single DataSeries/Plot/etc.Josh P.NinjaTrader Customer Service
Comment
-
I have tried making them plots, I have tried making them bare dataseries, I have tried making them simple double, I have tried assigning their values to seperate public vars... I have tried and tried and tried... Look at this script:
Code:protected override void Initialize() { CalculateOnBarClose = true; Overlay = true; PriceTypeSupported = false; Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "F90")); Add(new Plot(Color.FromKnownColor(KnownColor.LimeGreen), PlotStyle.Line, "F78")); Add(new Plot(Color.FromKnownColor(KnownColor.Yellow), PlotStyle.Line, "F62")); Add(new Plot(Color.FromKnownColor(KnownColor.Black), PlotStyle.Line, "F50")); Add(new Plot(Color.FromKnownColor(KnownColor.Yellow), PlotStyle.Line, "F38")); Add(new Plot(Color.FromKnownColor(KnownColor.LimeGreen), PlotStyle.Line, "F22")); Add(new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "F10")); D62 = new DataSeries(this); D38 = new DataSeries(this); } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (CurrentBar <1)return; if (Historical)return; F90.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .9) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F90Text","90%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .9) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F78.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .78) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F78Text","78%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .78) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F62.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .618) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F62Text","62%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .618) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F50.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .5) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F50Text","50%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .5) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F38.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .382) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F38Text","38%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .382) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F22.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .22) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F22Text","22%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .22) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); F10.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .1) + BegyHunniewellPeaks().CurrentPeakLow); DrawText("F10Text","10%",0,((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .1) + BegyHunniewellPeaks().CurrentPeakLow,Color.Black); D62.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .618) + BegyHunniewellPeaks().CurrentPeakLow + (TickSize * 2)); D38.Set(((BegyHunniewellPeaks().CurrentPeakHigh - BegyHunniewellPeaks().CurrentPeakLow) * .382) + BegyHunniewellPeaks().CurrentPeakLow - (TickSize * 2)); DrawRegion("Forbidden"+CurrentBar, CurrentBar, 1, D62, D38, Color.Empty, Color.LightCoral, 2); [COLOR=Red]RefTime = DateTime.Now.AddDays(-1); bAgo=GetBar(new DateTime(RefTime.Year,RefTime.Month,RefTime.Day,16,30,00)); SubjectBar = HighestBar(High,bAgo); HighPrice = High[SubjectBar]; SubjectBar = LowestBar(Low,bAgo); LowPrice = Low[SubjectBar]; OpenPrice = Open[bAgo]; H90.Set(((HighPrice-OpenPrice) * .78)+OpenPrice); H78.Set(((HighPrice-OpenPrice) * .78)+OpenPrice); H62.Set(((HighPrice-OpenPrice) * .618)+OpenPrice); H50.Set(((HighPrice-OpenPrice) * .50)+OpenPrice); H38.Set(((HighPrice-OpenPrice) * .382)+OpenPrice); H22.Set(((HighPrice-OpenPrice) * .22)+OpenPrice); H10.Set(((HighPrice-OpenPrice) * .10)+OpenPrice); L10.Set(((OpenPrice-LowPrice) * .10)+LowPrice); L22.Set(((OpenPrice-LowPrice) * .22)+LowPrice); L38.Set(((OpenPrice-LowPrice) * .382)+LowPrice); L50.Set(((OpenPrice-LowPrice) * .50)+LowPrice); L62.Set(((OpenPrice-LowPrice) * .618)+LowPrice); L78.Set(((OpenPrice-LowPrice) * .78)+LowPrice); L90.Set(((OpenPrice-LowPrice) * .90)+LowPrice);[/COLOR] }
H90.Set(((HighPrice-OpenPrice) * .78)+OpenPrice);
none of the publics in the script are exposed, or rather I should say, they all return "0".
This is how they are currently created:
Code:[COLOR=Red] [COLOR=Black][Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries F10 { get { return Values[6]; } } [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove private DataSeries H90 { get { return Values[7]; } }[/COLOR][/COLOR]
note: the F10 series was created by ninja script when I assigned it as a plot, I made H90...L90 private just to see if it helped, no joy!
Comment
-
Sleeping Troll, is there any simplified version showing the issue at hand I could run on my end?
What I don't understand why you need a private property for the H90...it's either a public one you can plot / access etc or just a internal private dataseries without the need to get into the properties region at all to use it normally.
ThanksBertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by SnailHorn, 03-27-2024, 09:54 AM
|
4 responses
16 views
0 likes
|
Last Post
by SnailHorn
Today, 09:19 AM
|
||
Started by ninza33, Today, 07:16 AM
|
3 responses
18 views
0 likes
|
Last Post
by ninza33
Today, 09:01 AM
|
||
Started by foxtrott21, Today, 08:27 AM
|
0 responses
4 views
0 likes
|
Last Post
by foxtrott21
Today, 08:27 AM
|
||
Started by jaypelle3, Today, 08:26 AM
|
0 responses
3 views
0 likes
|
Last Post
by jaypelle3
Today, 08:26 AM
|
||
Started by linkcou, Today, 07:01 AM
|
2 responses
25 views
0 likes
|
Last Post
by bltdavid
Today, 08:25 AM
|
Comment