Need to draw a dot above certain bars - NinjaTrader Programming | futures io social day trading
futures io futures trading


Need to draw a dot above certain bars
Updated: Views / Replies:3,385 / 2
Created: by bwlinux 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
 
Thread Tools Search this Thread
 

Need to draw a dot above certain bars

  #1 (permalink)
Elite Member
Houston, TX
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: ES, TF
 
Posts: 2 since Dec 2010
Thanks: 0 given, 0 received

Need to draw a dot above certain bars

I'm trying to draw a Dot above/below really large price bars on a 5 minute chart to help me identify a pattern of divergence on my smaller time frame chart. The problem is that it only draws the dot on the last big bar. I'd like it to leave the dot on ALL past big bars as I have other indicators that also change the bar color.

 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Alerts you to really large price bars
    /// </summary>
    [Description("Alerts you to really large price bars")]
    public class BigBarAlert : Indicator
    {
        #region Variables
            private int myBigBar = 50; // Default setting for MyInput0
            private int LastBarSize=0; // what's the size of the bar from hi to low.
            private string myAlert="alert1.wav"; // The alert wav file
            private bool myAudibleAlert=false;  //Whether to play the sound file
            private bool myPopUpAlert=false; //Whether to pop up an alert window
            private bool myChangeBarColor=true; //Whether to change big bar to gold
            private int myBarDirection=0; //0= Open/Close the same, -1 Close is below open, 1 Close is above Open 
        #endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        protected override void Initialize()
        {
            Overlay                = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {

            LastBarSize = (int)((High[0]-Low[0]) / TickSize); // gets range of bar and converts it to ticks for each market

            if (LastBarSize >= myBigBar) 
            {
            
                if (Close[0] > Open[0]) 
                { 
                    myBarDirection=1;
                } else if (Close[0] < Open[0]) 
                { 
                    myBarDirection=-1;
                } else {
                    myBarDirection=0;
                }
                
                if (myBarDirection==1) 
                {
                    DrawDot("BigBarDot",true, 0, High[0] + (TickSize * 5),Color.Gold);
                } else if (myBarDirection==-1)
                {
                    DrawDot("BigBarDot",true, 0, Low[0] - (TickSize * 5),Color.Gold);    
                }
                
                if (myChangeBarColor)
                {
                    BarColor = Color.Gold;
                }
                
                if (myAudibleAlert)
                {
                    PlaySound(@"C:\Program Files\NinjaTrader 7\sounds\" + myAlert);
                    // Print ("Play alert file" + LastBarSize.ToString() );
                    
                }
            }
        }

        #region Properties
        [XmlIgnore()]        // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        
        
        
        [Description("Big Bar in ticks, 100 max")]
        [GridCategory("Parameters")]
        public int Big_Bar
        {
            get { return myBigBar; }
            set { myBigBar = Math.Max(1, value); }
        }
        
        [Description("Alert via sound")]
        [GridCategory("Parameters")]
        public bool Audible_Alert
        {
            get { return myAudibleAlert; }
            set { myAudibleAlert = value; }
        }
        
        [Description("Alert sound file")]
        [GridCategory("Parameters")]
        public string Audible_Alert_File
        {
            get { return myAlert; }
            set { myAlert = value; }
        }
        
        [Description("Change the big bar's color")]
        [GridCategory("Parameters")]
        public bool Change_Bar_Color
        {
            get { return myChangeBarColor; }
            set { myChangeBarColor = value; }
        }
        #endregion
        
    }
}
I have tried using a Plot instead but that seems to be something you only want to do for each and every bar. Any help from the gurus is greatly appreciated.

Attached Thumbnails
Need to draw a dot above certain bars-capture.jpg  
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
Orlando, Florida
 
Futures Experience: Advanced
Platform: NinjaTrader, TradeStation, MultiCharts, eSignal, MetaTrader
Favorite Futures: ES
 
Posts: 56 since Aug 2010
Thanks: 3 given, 66 received


You must give all of your Drawing Objects a unique name. Try changing:
 
Code
                            
DrawDot("BigBarDot",true0High[0] + (TickSize 5),Color.Gold); 

To:

 
Code
                            
DrawDot(CurrentBar.ToString() + "BigBarDot",true0High[0] + (TickSize 5),Color.Gold); 


Reply With Quote

Reply



futures io > > > > > Need to draw a dot above certain bars

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
Get all draw objects dimkdimk NinjaTrader Programming 18 February 14th, 2015 12:46 PM
Little help with Draw Region jram77 NinjaTrader Programming 14 September 26th, 2013 12:21 AM
renko bars vs range bars? shodson Traders Hideout 21 April 26th, 2012 04:52 PM
Plot a dot (multicharts) Ozons EasyLanguage Programming 3 February 8th, 2011 01:08 PM
plot color dot on High/low edi025 NinjaTrader Programming 3 June 28th, 2010 10:22 AM


All times are GMT -4. The time now is 08:36 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-10 in 0.06 seconds with 20 queries on phoenix via your IP 54.83.122.227