NinjaTrader Buttons
Written by Futures Trader - Fool   

The following code allows you to add Chart buttons to NinjaTrader Version 7.0

These buttons can be used to toggle values in a strategy or execute orders when clicked.  This is very useful in adding an additional level of control to your strategy. When trading using a strategy you can use the buttons to expose some of the strategy features and toggle them on and off based on market conditions.

 

#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.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
using System.IO;
using System.Collections;
using System.Windows.Forms;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
///
/// </summary>
[Description("")]
public class ToolBarButtons : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)

private System.Windows.Forms.ToolStrip strip = null;
private System.Windows.Forms.Control[] controls    = null;

private System.Windows.Forms.ToolStripButton btnManual = null;
private System.Windows.Forms.ToolStripButton btnEntry = null;

private Font boldFont = null;
private Font regularFont = null;
private bool buttonsloaded = false;
#endregion



/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
}

protected override void Initialize()
{
System.Windows.Forms.Control[] controls =
ChartControl.Controls.Find("tsrTool", false);

if (controls.Length > 0) {

ToolStripButton btnTemp = new System.Windows.Forms.ToolStripButton("temp");
boldFont = new Font("Arial", 8,FontStyle.Bold);
regularFont = new Font("Arial", 8);
btnTemp = null;

btnManual = new System.Windows.Forms.ToolStripButton("btnManual");
//btnManual.Font = boldFont;
btnManual.Font =regularFont ;   
btnManual.ForeColor = Color.White;
btnManual.BackColor=Color.Green;   
btnManual.Text = "Auto";


strip = (System.Windows.Forms.ToolStrip)controls[0];

strip.Items.Add(btnManual);
btnManual.Click += btnManual_Click;

btnEntry = new System.Windows.Forms.ToolStripButton("btnManual");
//btnEntry.Font = boldFont;
btnEntry.Font = regularFont;
btnEntry.ForeColor = Color.Black;
btnEntry.BackColor=Color.Green;
btnEntry.Text = "Enter ON";

strip.Items.
Add(btnEntry);
btnEntry.Click += btnEntry_Click;   
buttonsloaded=true;

}

}
public override void Dispose() {
if (buttonsloaded==true)
{
strip.Items.Remove(btnManual);
strip.Items.Remove(btnEntry);
}

}

private void btnManual_Click(object sender, EventArgs e)
{
if (btnManual.Text == "Manual")
{
btnManual.Text = "Auto";
btnManual.Font =regularFont ;
btnManual.ForeColor = Color.White;
btnManual.BackColor=Color.Green;
}
else {
btnManual.Text = "Manual";
btnManual.Font =boldFont ;
btnManual.ForeColor = Color.White;
btnManual.BackColor=Color.Red;
}

Alert("MjCHD_IB", NinjaTrader.Cbi.Priority.Low, "HD Entry Detected", "Alert1.wav", 4, Color.Black, Color.Yellow);

btnManual.Enabled = true;
}
private void btnEntry_Click(object sender, EventArgs e)
{
if (btnEntry.Text == "Enter ON")
{
btnEntry.Text = "Enter OFF";
btnEntry.Font = boldFont ;
btnEntry.ForeColor = Color.Black;
btnEntry.BackColor=Color.Red;

}
else
{

btnEntry.Text = "Enter ON";
btnEntry.Font = regularFont ;
btnEntry.ForeColor = Color.Black;
btnEntry.BackColor=Color.Green;
}

btnEntry.Enabled = true;

}
protected override void OnBarUpdate()
{

if (btnEntry.Text == "Enter ON")
{
btnEntry.Text = "Enter OFF";
btnEntry.Font = boldFont ;
btnEntry.ForeColor = Color.Black;
btnEntry.BackColor=Color.Red;


///
/// Now Make Your Make Your Entry Here
//
if (btnManual.Text != "Manual")
{

// Do Something Here
Alert("Fun", NinjaTrader.Cbi.Priority.Low, "Entry Type 1 Detected", "Alert4.wav", 4, Color.Black, Color.Yellow);

}
else
{
Alert("Fun", NinjaTrader.Cbi.Priority.Low, "Entry Type 2 Detected", "Alert3.wav", 4, Color.Black, Color.Yellow);   
}   
}
}
#region Properties
#endregion
}
}

 
Understanding Highs and Lows
Written by Administrator   

Technical Analysis is a method of predicting future price movements of a stock or commodity instrument based on observations of historical stock or commodity price movements. The analysis is based on the movement of price itself through careful chart study.  Often you find price action traders watching moving averages, and volume.  Additionally price action traders are often marking their charts with known support and resistance lines as well as trend lines.  Other price action traders prefer to "go naked."  No matter what side of the fence you are on, be it a price action trader, pattern trader or a trader that prefers to make long trade and short trade entries off indicators, a proper understanding of a inancial instruments trends and swings is a tool that should be in every traders tool box.

With time, practice, discipline, and self control understanding trends and swings can be learned and mastered.  The most basic concept that needs to be understood when discussing price action is the concept of different types of swings and how they are created by:

    Higher Highs (HH)
    Lower Highs (LH)
    Lower Lows (LL)
    Higher Lows (HL)


To understand this concept clearly lets take a look at a simple Highs and a simple Lows on a chart from the 6E below.

Highs_Lows.png

You can clearly see where price has made Highs and Lows based on the notations on the chart. It is critical to understand this concept. Highs and Lows represent pullbacks in price and continuation of price with trend. Understood properly, a combination of Highs and Lows formed as price action develops can tell us what the likely direction of trend for the market. There are many factors used to determine trend, but understanding Highs and Lows is a fundamental building block.

Now we add in the concept of Higher Highs, Lower Highs, Lower Lows and Higher Lows. Take a look at the same chart marked up with additional detail.

HH_LL.png

As you can see by the additional information marked on the chart, all highs and lows are not created equally. The High at position "2" is lower than the previous high at position "1" making the high at position "2" a Lower High (LH). A single Lower High (LH) is not definitive of market direction and we see that clearly as price moves up to make a Higher High (HH) marked in position "3". This high is higher than the high at position "2" so it is called a Higher High (HH). Each of the reversals in price are called Swings. The definition of swing is to move back and forth. If price stops moving higher and clearly turns and begins to move towards a lower prices, and this movement of price is clearly displayed by 3 or more candles or bars on your chart, then the formation of the Higher High (HH) or Lower High (LH) is called a Swing High. In order to have a swing high, the candles on either side of the High Bar must have closed below the High of the High Bar. Without a price reversal, you do not have a Swing High.

The same principles are applied to Lows. The Low at position "B" is lower than the previous low at position "A" making the high at position "B" a Lower Low (LL). A single Lower Low (LL) is not definitive of market direction and we see that clearly as price reverses and moves up to make a Higher Low (HL) marked in position "C". This Low is higher than the Low at position "B" so it is called a Higher Low (HL). Each of the reversals likewise are called Swing Lows when the swing is clearly displayed by 3 or more candles or bars on your chart.

For more information on highs, lows and swings please review our section on price action trading here.

 
NinjaTrader 7.0 Time and Sales
Written by Trade Futures   

While we did not create this indicator; we made it better.  We have released a new NinjaTrader Time and Sales indicator that now adds FILTER and OFFSET functionality to the Time and Sales Indicator for NinjaTrader 7.0  NinjaTrader refreshes the version 7.0 time and sales window on a 250 ms timer.  Unlike version 6.5 which allowed a real time steaming of time and sales, version 7.0 currently does not have this option.  Many tape traders prefer to see the tape rolling as close to real time as possible and this indicator allows you to place time and sales data in any chart window and stream the data with real time updates.  This version of the control provides the market instrument's daily traded volume as well as additional parameters that allow you to FILTER the time and sales data by size, and adjust the Time and Sales data position on the chart.

 

 
<< Start < Prev 1 2 Next > End >>

Page 1 of 2