NexusFi: Find Your Edge


Home Menu

 





DrawRegion between MAs - Color between bars? - help required


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one techoli with 3 posts (2 thanks)
    2. looks_two kronie with 1 posts (0 thanks)
    3. looks_3 Tasker_182 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 1,922 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 5 attachments




 
Search this Thread

DrawRegion between MAs - Color between bars? - help required

  #1 (permalink)
 techoli 
Nelson, New Zealand
 
Experience: Intermediate
Platform: NinjaTrader
Trading: NQ/MNQ/CL
Posts: 35 since Mar 2013
Thanks Given: 17
Thanks Received: 49

Hey guys,


I'm relatively new to coding etc and have made the attached indicator.


It's a wave based on 2 moving averages that uses DrawRegion to color it self (Up/Down/Flat).
if (angleCheck >= slope*.1*TickSize)
{DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, upColour, opacity);
}
if (angleCheck <= -slope*.1*TickSize)
{
DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, downColour, opacity);
}
if (angleCheck < slope*.1*TickSize && angleCheck > -slope*.1*TickSize)
{
DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, flatColour, opacity);
}

If you refer to the attached image: "Example.jpg"
*You can see that the coloring starts in the middle of candle A and colors to candle B.
*I would like the candle coloring to start where 'A' is, however finish where line 'C' is. "Eg; color between bars not on the actual bar" (a second example of how I'd like to do the coloring is in attachment: Example2.jpg -- based on where- where the vertical lines are)


I thought it may be able to be done somehow with:
"ChartControl.GetXByBarIdx(Bars, CurrentBar) - (ChartControl.BarSpace/2)"

However, I am not sure where to being etc.


Is anyone able to please assist me with this? would be greatly appreciated


Thanks,
Techoli

Attached Thumbnails
Click image for larger version

Name:	Example.JPG
Views:	148
Size:	32.3 KB
ID:	128203   Click image for larger version

Name:	Example 2.JPG
Views:	151
Size:	31.9 KB
ID:	128204  
Attached Files
Elite Membership required to download: _J_Wave.cs
Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
MC PL editor upgrade
MultiCharts
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Exit Strategy
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
kronie's Avatar
 kronie 
NYC + NY / USA
 
Experience: Advanced
Platform: "I trade, therefore, I AM!"; Theme Song: "Atomic Dog!"
Trading: EMD, 6J, ZB
Posts: 796 since Oct 2009



techoli View Post
Hey guys,


I'm relatively new to coding etc and have made the attached indicator.


It's a wave based on 2 moving averages that uses DrawRegion to color it self (Up/Down/Flat).
if (angleCheck >= slope*.1*TickSize)
{DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, upColour, opacity);
}
if (angleCheck <= -slope*.1*TickSize)
{
DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, downColour, opacity);
}
if (angleCheck < slope*.1*TickSize && angleCheck > -slope*.1*TickSize)
{
DrawRegion("DrawRegion"+CurrentBar,1, 0, maWaveFast, maWaveSlow, Color.Transparent, flatColour, opacity);
}

If you refer to the attached image: "Example.jpg"
*You can see that the coloring starts in the middle of candle A and colors to candle B.
*I would like the candle coloring to start where 'A' is, however finish where line 'C' is. "Eg; color between bars not on the actual bar" (a second example of how I'd like to do the coloring is in attachment: Example2.jpg -- based on where- where the vertical lines are)


I thought it may be able to be done somehow with:
"ChartControl.GetXByBarIdx(Bars, CurrentBar) - (ChartControl.BarSpace/2)"

However, I am not sure where to being etc.


Is anyone able to please assist me with this? would be greatly appreciated


Thanks,
Techoli


when you choose Export ninja indicator, it creates a zip file version of the indicator

Reply With Quote
  #4 (permalink)
 techoli 
Nelson, New Zealand
 
Experience: Intermediate
Platform: NinjaTrader
Trading: NQ/MNQ/CL
Posts: 35 since Mar 2013
Thanks Given: 17
Thanks Received: 49

Sorry, yes, I didn't notice that I uploaded the cs file. I have attached the .zip version.


Fat Tails recommended that I try the TriggerLines indicator. I had a look at that one and the coloring aligns with the candles still.

My goal is to color the wave in-between candles. I hand-made a picture of what I'm trying to achieve regarding the coloring between candles (attached). I think this is done by overriding plot. However, no idea where to start.

Attached Thumbnails
Click image for larger version

Name:	Coloring.JPG
Views:	153
Size:	17.9 KB
ID:	128602  
Attached Files
Elite Membership required to download: J_Wave.zip
Started this thread Reply With Quote
  #5 (permalink)
 
Tasker_182's Avatar
 Tasker_182 
Cedar Rapids, iowa
Legendary Market Wizard
 
Experience: Intermediate
Platform: Ninjatrader
Broker: Ninjatrader - Continuum
Posts: 716 since Aug 2009
Thanks Given: 476
Thanks Received: 1,401


techoli View Post
Sorry, yes, I didn't notice that I uploaded the cs file. I have attached the .zip version.


Fat Tails recommended that I try the TriggerLines indicator. I had a look at that one and the coloring aligns with the candles still.

My goal is to color the wave in-between candles. I hand-made a picture of what I'm trying to achieve regarding the coloring between candles (attached). I think this is done by overriding plot. However, no idea where to start.


Another option (untested by me) may be to add another data series at twice the sampling rate (IE: if main series 1 minute candle, add 30 second candles), hide the added data series by setting it to line on close and turning the line color then to transparent (make sure to overlay as well in same panel). Then using your logic on the main data series to determine the colors, actuate the drawregion using the secondary series which should have candles between your main series.

Be yourself; everyone else is already taken. Oscar Wilde
Reply With Quote
  #6 (permalink)
 techoli 
Nelson, New Zealand
 
Experience: Intermediate
Platform: NinjaTrader
Trading: NQ/MNQ/CL
Posts: 35 since Mar 2013
Thanks Given: 17
Thanks Received: 49


Tasker_182 View Post
Another option (untested by me) may be to add another data series at twice the sampling rate (IE: if main series 1 minute candle, add 30 second candles), hide the added data series by setting it to line on close and turning the line color then to transparent (make sure to overlay as well in same panel). Then using your logic on the main data series to determine the colors, actuate the drawregion using the secondary series which should have candles between your main series.


I'll give that a shot, also will try a couple other ideas and let you know how i progress.

Started this thread Reply With Quote
Thanked by:




Last Updated on November 14, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts