NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 01-06-2012, 11:56 AM   #1
thomson
Junior Member
 
Join Date: Dec 2011
Posts: 22
Thanks: 6
Thanked 1 time in 1 post
Default How can I show a buy/sell signal on the chart

Hi,

I am just begin to write some auto trading code. for buy/sell action, I want to add some buy and sell signals/signs on the chart.

How can I add that?

Thanks in advance
Thomson
thomson is offline  
Reply With Quote
Old 01-06-2012, 12:20 PM   #2
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,694
Thanks: 116
Thanked 193 times in 188 posts
Default

Hello thomson,

Thank you for your post and welcome to the NinjaTrader Support Forum.

You can add a custom drawing object to a chart with a strategy by defining the condition and then programming the custom drawing object.

For a reference on adding custom plots to a strategy please visit the following link: http://www.ninjatrader.com/support/f...ead.php?t=6651

You can find information on adding custom shapes, lines, text and colors to your indicators and strategies at the following link: http://www.ninjatrader.com/support/h...ml?drawing.htm

Please let me know if I may be further assistance.
NinjaTrader_PatrickH is offline  
Reply With Quote
The following user says thank you to NinjaTrader_PatrickH for this post:
Old 01-06-2012, 01:28 PM   #3
thomson
Junior Member
 
Join Date: Dec 2011
Posts: 22
Thanks: 6
Thanked 1 time in 1 post
Default

Patrick,

Thanks for your quick respond. I download the SampleStrategyPlot and load the strategy to my chart. It doesn't show any plot. Is there anything wrong?

Anyway, Could you please help me add a plot to me code? Please see my sample strategy blow,

#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;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Simple MA Cross Strategy
/// </summary>
[Description("Simple MA Cross Strategy")]
public class zyySMA : Strategy
{
#region Variables
// Wizard generated variables
private int fast = 5; // Default setting for Fast
private int slow = 20; // Default setting for Slow
// User defined variables (add any user defined variables below)
#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()
{
Add(SMA(Fast));
Add(SMA(Slow));

CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (CrossAbove(SMA(Fast), SMA(Slow), 1))
{
EnterLong(DefaultQuantity, "1");
}

// Condition set 2
if (CrossBelow(SMA(Fast), SMA(Slow), 1))
{
EnterShort(DefaultQuantity, "1");
}
}

#region Properties
[Description("Fast MA Period")]
[GridCategory("Parameters")]
public int Fast
{
get { return fast; }
set { fast = Math.Max(1, value); }
}

[Description("Slow MA Period")]
[GridCategory("Parameters")]
public int Slow
{
get { return slow; }
set { slow = Math.Max(1, value); }
}
#endregion
}
}

Thanks in advance

Thomson
thomson is offline  
Reply With Quote
Old 01-06-2012, 02:09 PM   #4
NinjaTrader_PatrickH
NinjaTrader Customer Service
 
NinjaTrader_PatrickH's Avatar
 
Join Date: Jul 2011
Location: Denver, CO, USA
Posts: 1,694
Thanks: 116
Thanked 193 times in 188 posts
Default

Hello thomson,

Thank you for your response.

Strategies will have to be enabled on your chart by right clicking in your chart > select Strategies > left click on your strategy > change the 'Enabled' parameter to 'True'.
For information on working with strategies please visit the following link: http://www.ninjatrader.com/support/h...ed_strateg.htm

You can plot indicators on your chart through the strategy and you can draw an object such as a line to indicate the buy/sell signal. Which one would you like to see an example of?

I look forward to assisting you further.
NinjaTrader_PatrickH is offline  
Reply With Quote
The following user says thank you to NinjaTrader_PatrickH for this post:
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Darvas Box Buy / Sell Signal Richard168 Indicator Development 12 11-08-2011 09:57 AM
New Charts show old buy and sell points larrylwill Charting 1 06-27-2011 09:59 PM
Script is running wild: buy - sell - buy - sell ... BillCh Automated Trading 4 02-06-2009 01:01 PM
Buy Sell Indicators on Price Chart rtj4201 Charting 3 01-15-2009 04:09 PM
How to make a buy and sell signal? fragalles Strategy Development 12 08-09-2008 02:58 PM


All times are GMT -6. The time now is 02:17 PM.