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
Changing DrawRegion?
Collapse
X
-
Nope. Please refer to my previous post. If you want alternating color ranges you need to manually submit all the different regions. Check the syntax on DrawRegion(). You are constantly overriding the complete range. CurrentBar all the way to bar 0. This is why the whole range is being colored.Josh P.NinjaTrader Customer Service
-
I've setup the following code:
if(BLUE_ZONE == -1){BLUE_ZONE = CurrentBar; YELLOW_ZONE = -1;} Print("BLUE_ZONE: = " + BLUE_ZONE);
DrawRegion("MYREGION", BLUE_ZONE, 0, Bollinger(2, 14).Upper, Bollinger(2, 14).Lower, Color.Empty, Color.Blue, 2);
I'm sure the logic and syntax are correct, however it is still painting going back from the first bar on the chart. I'm sure this is because the value for "BLUE_ZONE" is being set by using the "CurrentBar" command...as this will instruct to start at first bar on chart. My question is how to get around this? Is there some other command to use to substitute for "CurrentBar" in situations like these that involve "Bars Ago" instrucitons?
Comment
-
Converting double to IDataSeries for DrawRegion()
Hello.
I'm calculating the upper and lower bounds of Bollinger Bands using the following code :
Values[3].Set(EMA(MACD(fastLen, slowLen, smooth),smooth)[0] + stDv * StdDev(MACD(fastLen, slowLen, smooth),smooth)[0]);
Values[4].Set(EMA(MACD(fastLen, slowLen, smooth),smooth)[0] - stDv * StdDev(MACD(fastLen, slowLen, smooth),smooth)[0]);
When I try to use those values in DrawRegion() I run into problems because its looking for two iDataSeries values. The compiler complains that the above values are 'double', which they are.
DrawRegion("Area", CurrentBar, 0, EMA(MACD(...))[0], EMA(MACD(...))[0], Color.Empty, Color.Blue, 2)
Question. How do I convert the calculated 'double' values into idataseries values so it will be accepted in DrawRegion() by the compiler ?
Regards,
R. C. Singleton
Comment
-
DrawRegion()
Hello again.
I got this to compile :
Values[3].Set(EMA(MACD(fastLen, slowLen, smooth),smooth)[0] + stDv * StdDev(MACD(fastLen, slowLen, smooth),smooth)[0]);
Values[4].Set(EMA(MACD(fastLen, slowLen, smooth),smooth)[0] - stDv * StdDev(MACD(fastLen, slowLen, smooth),smooth)[0]);
DrawRegion("Area", CurrentBar, 0, Values[3],Values[4],Color.Empty,Color.Gray, 6);
But its not drawing in the area between the BB bands. It looks like its not doing anything.
Also, if I replace Values[3] and Values[4] with your suggestion in the last post, I get compiler error CS109. Can't use '*' operator with int stDV and function StdDev.
Regards,
R. C. Singleton
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Padan, Today, 02:02 AM
|
3 responses
11 views
0 likes
|
Last Post Today, 08:54 AM | ||
Started by Tim-c, Today, 08:36 AM
|
1 response
3 views
0 likes
|
Last Post Today, 08:45 AM | ||
Started by goodknight777, Today, 08:43 AM
|
0 responses
2 views
0 likes
|
Last Post Today, 08:43 AM | ||
Started by martini, Yesterday, 04:45 PM
|
3 responses
28 views
0 likes
|
Last Post Today, 08:38 AM | ||
Started by Mestor, Today, 03:15 AM
|
2 responses
10 views
0 likes
|
Last Post
by Mestor
Today, 08:36 AM
|
Comment