Little help with Draw Region - NinjaTrader Programming | futures io social day trading
futures io futures trading


Little help with Draw Region
Updated: Views / Replies:3,939 / 14
Created: by jram77 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 1  
 
Thread Tools Search this Thread
 

Little help with Draw Region

  #11 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,220 since Jun 2009
Thanks: 628 given, 6,318 received
Forum Reputation: Legendary

try DrawOnPricePanel = false, examp:


DrawOnPricePanel = false;
DrawTextFixed("Daily Volume",mystring,TextPosition.TopRight);
DrawOnPricePanel = true;

Reply With Quote
The following user says Thank You to cory for this post:
 
  #12 (permalink)
Market Wizard
Las Vegas, NV
 
Futures Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Favorite Futures: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,053 given, 5,822 received
Forum Reputation: Legendary


cory View Post
try DrawOnPricePanel = false, examp:


DrawOnPricePanel = false;
DrawTextFixed("Daily Volume",mystring,TextPosition.TopRight);
DrawOnPricePanel = true;

@cory,

Thanks a bunch, works great!

Reply With Quote
 
  #13 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary



aligator View Post
@Fat Tails,

Can one use the Drawregion to fill between say the 30 and 70 lines on RSI indicator in indicator panel?

I tried it, but it painted inside the entire main series panel.

Thanks.

DrawRegion() can be used to fill the space

-> between two plots
-> or between a plot and a horizontal line

For your purpose, which is filling the space between two horizontal lines, I would suggest to use the NinjaScript method DrawRectangle(). The only problem with DrawRectangle() is that it plots on top of the lines plotted by the same indicator, while DrawRegion() is well behaved and draws behind.

In case that you want to fill the area behind all indicator plots and lines, which is impossible to achieve with DrawRectangle() you have two options

-> add a transparent plot which takes the constant value 30 (or 70) and then apply DrawRegion() to that plot and the other fixed line
-> add a custom plot to the indicator, which simply fills the area between the two lines

The last option is the most elegant one. You just need to code a few lines to achieve it. Below is a code snippet that you can use or modify for a custom plot.

 
Code
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
    if (Bars == null || ChartControl == null || this.LastBarIndexPainted < BarsRequired)
	 return;
    SolidBrush fillBrush = new SolidBrush(fillColor);
    int firstXToFill = ChartControl.GetXByBarIdx(BarsArray[0], this.LastBarIndexPainted);
    int lastXToFill = ChartControl.GetXByBarIdx(BarsArray[0], this.FirstBarIndexPainted);
    int yHigh = ChartControl.GetYByValue(this, 70) + (int)Lines[1].Pen.Width;
    int yLow = ChartControl.GetYByValue(this, 30);
    graphics.FillRectangle(fillBrush, lastXToFill, yHigh, firstXToFill - lastXToFill, yLow-yHigh);      
    base.Plot(graphics, bounds, min, max);
}


I have just written this down to explain the approach, I have not tested the code for bugs.


Last edited by Fat Tails; September 25th, 2013 at 02:17 AM.
Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:
 
  #14 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,602 received
Forum Reputation: Legendary

Alternatively, if you want to color the space between the two lines over the entire chart, you could try


 
Code
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
     if (Bars == null || ChartControl == null || this.LastBarIndexPainted < BarsRequired)
          return;
     SolidBrush fillBrush = new SolidBrush(fillColor);
     int firstXToFill = ChartControl.Bounds.Right;
     int lastXToFill = ChartControl.Bounds.Left;
     int yHigh = ChartControl.GetYByValue(this, 70) + (int)Lines[1].Pen.Width;
     int yLow = ChartControl.GetYByValue(this, 30);
     graphics.FillRectangle(fillBrush, lastXToFill, yHigh, firstXToFill - lastXToFill, yLow-yHigh);      
     base.Plot(graphics, bounds, min, max);
}


I assume that you declare fillColor in the variables section and also declare a property allowing you to change it.

Reply With Quote
The following user says Thank You to Fat Tails for this post:
 
  #15 (permalink)
Market Wizard
Las Vegas, NV
 
Futures Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Favorite Futures: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,053 given, 5,822 received
Forum Reputation: Legendary


Fat Tails View Post
Alternatively, if you want to color the space between the two lines over the entire chart, you could try


 
Code
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
{
     if (Bars == null || ChartControl == null || this.LastBarIndexPainted < BarsRequired)
          return;
     SolidBrush fillBrush = new SolidBrush(fillColor);
     int firstXToFill = ChartControl.Bounds.Right;
     int lastXToFill = ChartControl.Bounds.Left;
     int yHigh = ChartControl.GetYByValue(this, 70) + (int)Lines[1].Pen.Width;
     int yLow = ChartControl.GetYByValue(this, 30);
     graphics.FillRectangle(fillBrush, lastXToFill, yHigh, firstXToFill - lastXToFill, yLow-yHigh);      
     base.Plot(graphics, bounds, min, max);
}


I assume that you declare fillColor in the variables section and also declare a property allowing you to change it.

@Fat Tails,

Most helpful, Thank you!

Reply With Quote

Reply



futures io > > > > > Little help with Draw Region

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Get all draw objects dimkdimk NinjaTrader Programming 18 February 14th, 2015 12:46 PM
Fib extenions I can draw ricktrades ThinkOrSwim 3 July 7th, 2014 02:38 PM
Massive Undiscovered Oil and Gas Reserves in the Cook Inlet Region kbit Commodities Futures Trading 1 July 1st, 2011 11:44 PM
NT7 MA region color indicator Doppio NinjaTrader 10 June 10th, 2010 12:19 AM
MA region color indicator. help needed Doppio NinjaTrader Programming 3 June 8th, 2010 08:32 AM


All times are GMT -4. The time now is 06:28 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-17 in 0.09 seconds with 20 queries on phoenix via your IP 54.82.81.154