Is it possible to access these bar price collections in GetMinMaxValues()? I have noticed that CurrentBar is always -1 inside the scope of that function. Does anybody know why?
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
Bar price collections in GetMinMaxValues()
Collapse
X
-
Bar price collections in GetMinMaxValues()
I am trying to get the values of High[0] and Low[0] in GetMinMaxValues() but an ArgumentOutOfRangeException is triggered. I have tried to get Open[0] and Close[0] but I couldn't either.
Is it possible to access these bar price collections in GetMinMaxValues()? I have noticed that CurrentBar is always -1 inside the scope of that function. Does anybody know why?Tags: None
-
Originally posted by windcatcher View PostI am trying to get the values of High[0] and Low[0] in GetMinMaxValues() but an ArgumentOutOfRangeException is triggered. I have tried to get Open[0] and Close[0] but I couldn't either.
Is it possible to access these bar price collections in GetMinMaxValues()? I have noticed that CurrentBar is always -1 inside the scope of that function. Does anybody know why?
Code:public override void GetMinMaxValues(ChartControl chartControl, ref double min, ref double max) { base.GetMinMaxValues(chartControl, ref min, ref max); int bars = base.ChartControl.BarsPainted; Exception caughtException; while (bars >= 0) { int index = base.ChartControl.LastBarPainted -base.ChartControl.BarsPainted + 1 + bars; if (base.ChartControl.ShowBarsRequired || ((index - base.Displacement) >= base.BarsRequired)) { try { double thisHigh = dsHigh.Get(index); double thisLow = dsLow.Get(index); if ((!double.IsNaN(thisHigh)) && (index>0)) { if (thisHigh>max) max=thisHigh; if (thisHigh<min) min=thisHigh; } if ((!double.IsNaN(thisLow)) && (index>0)) { if (thisLow>max) max=thisLow; if (thisLow<min) min=thisLow; } } catch (Exception exception) { caughtException=exception; } } bars--; } }
-Alex
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by linkcou, Today, 07:01 AM
|
1 response
13 views
0 likes
|
Last Post
by balltrader
Today, 08:07 AM
|
||
Started by ninza33, Today, 07:16 AM
|
2 responses
7 views
0 likes
|
Last Post Today, 08:05 AM | ||
Started by ellington, Today, 07:40 AM
|
0 responses
5 views
0 likes
|
Last Post
by ellington
Today, 07:40 AM
|
||
Started by Atticus20, Today, 07:27 AM
|
0 responses
10 views
0 likes
|
Last Post
by Atticus20
Today, 07:27 AM
|
||
Started by brunoviveiros, 02-17-2020, 05:31 AM
|
4 responses
66 views
0 likes
|
Last Post Today, 06:25 AM |
Comment