can you help with code, would like to paint low volume bar black - NinjaTrader | futures io social day trading
futures io futures trading


can you help with code, would like to paint low volume bar black
Updated: Views / Replies:1,561 / 4
Created: by anniebee321 Attachments:0

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
 
Thread Tools Search this Thread
 

can you help with code, would like to paint low volume bar black

  #1 (permalink)
Elite Member
london
 
Futures Experience: Beginner
Platform: ninja
Favorite Futures: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

can you help with code, would like to paint low volume bar black

why is this not working??
would like to paint volume bar black if it is below a certain amount
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Lime, 2), PlotStyle.Bar, "UpVolume"));
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Bar, "DownVolume"));
Add(new Plot(new Pen(Color.Black, 2), PlotStyle.Bar, "LowVol"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
DrawOnPricePanel = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Close[0] >= Open[0])
{
Values[0].Set(Volume[0]);
Values[1].Reset();

if (Volume[1]<x)
{ Values[2].Set(Volume[1]);
}
}
else
{
Values[1].Set(Volume[0]);
Values[0].Reset();
if (Volume[1]<x)
{ Values[2].Set(Volume[1]);

many thanks for your help/advise

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

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

Answer
This post has been selected as an answer to the original posters question Answer


Here are some changes that I suggest. Have not tested them. Also ou need to declare the Variable x via "double x = 0.0;" somewhere.

 
Code
 
protected override void Initialize()
{
Add(new Plot(new Pen(Color.Lime, 2), PlotStyle.Bar, "UpVolume"));
Add(new Plot(new Pen(Color.Red, 2), PlotStyle.Bar, "DownVolume"));
Add(new Plot(new Pen(Color.Black, 2), PlotStyle.Bar, "LowVol"));
Add(new Line(Color.DarkGray, 0, "Zero line"));
Overlay = false;  // DrawOnPricePanel is needed for additional drawing features, you probably mean "Overlay = false;"
}
 
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (Close[0] >= Open[0])
{
Values[0].Set(Volume[0]);
Values[1].Set(0.0);
} 
else // continue here for negative volume
{
Values[1].Set(Volume[0]);
Values[0].Set(0.0);
} 
// good idea to repaint the last bar after it became a low volume bar, but the first bar on the chart (index 0)does not have a last bar, so you may only start this with the second bar (index 1) -> CurrentBar > 0 is required
if (CurrentBar > 0 && Volume[1] < x)
{ 
Values[0].Set(1,0.0);
Values[1].Set(1,0.0);
Values[2].Set(1, Volume[1]); // you do not want to set the value for the current volume bar but for the prior bar
so you need to use the correct syntax Set( int barsAgo, double value)
}
Values[2].Set(0.0); // always, only affects the current incomplete bar
}
Further suggestions:

If you post code, you can use [Code] tags -> just highlight the code and select # on your task bar

The condition
 
Code
 
if (CurrentBar > 0 && Volume[1] < x)
will work but is annoying, because you have to change the value of x for every instrument. You could try
 
Code
 
if(CurrentBar > 10 && Volume[1] == MIN(Volume, 10)[1])
This would show the bar as a low volume bar, if it has the lowest volume of the last 20 bars - not including the current active bar, which is yet incomplete.


Last edited by Fat Tails; December 18th, 2010 at 10:59 AM.
Reply With Quote
 
  #4 (permalink)
Elite Member
london
 
Futures Experience: Beginner
Platform: ninja
Favorite Futures: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

low vol code

thank you soooo much fat tails - i get the gist of yr code and will play around with it

Reply With Quote
 
  #5 (permalink)
Elite Member
london
 
Futures Experience: Beginner
Platform: ninja
Favorite Futures: fgbl
 
Posts: 152 since Nov 2009
Thanks: 64 given, 44 received

low vol code

yep, code is correct - just needed to declare variable as you said

Reply With Quote

Reply



futures io > > > > can you help with code, would like to paint low volume bar black

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Do black-box algorithms move the ES with excessive volume to make just a tick or two? sidney7g Emini Index Futures Trading 15 June 12th, 2011 02:21 PM
Color changing Regression Line with Paint Bar Gibby NinjaTrader Programming 49 April 23rd, 2010 03:54 PM
Moving Average Paint Bar pchofard The Elite Circle 39 April 17th, 2010 11:30 PM
Paint bar blind test Zoethecus NinjaTrader 22 December 25th, 2009 12:42 PM
3 bar high/low entry maintain active order until 3 bar high/low in opposite direction mrticks NinjaTrader Programming 8 November 13th, 2009 08:44 PM


All times are GMT -4. The time now is 09:02 PM.

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-11 in 0.11 seconds with 27 queries on phoenix via your IP 54.83.122.227