Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
10 pip audio alert
Collapse
X
-
10 pip audio alert
Hey Guys, let me start out by saying Im not a programmer so I know next to nothing about computer programming with ninja trader which is why I was wondering if someone on here could help me? What I am trying to do is figure out how to program an audio alert when the price moves 10 pips from a top or bottom. The reason behind all this would be for me to hear an alert that that market is actually moving and is not channeling. Example: the top is hit at say 1.3050 on the EU. The price moves down 10 pips, I get an alert that the price moved down 10 pips to 1.3040 Then the price moves down another 10 pips and makes a bottom then goes back up 10 pips up to 1.3040 again and I get another audio alert because the price went up 10 pips from the bottom. Basically I want the 10 pips from the tops or bottoms to alert me. This would help me hear when the market is moving. I know it might seem complicated but its really just to gauge the market movement going on. As far as the programming is concerned, I dont think it would be difficult to make it but I dont even know where to start. LOL Im a business major, not computer science major. I think I have to use the bars back function but or maybe the higher highs or lower lows function but I dont know what I am suppose to type. If anyone could help me with that I would deeply appreciate it or if they know if someone else has already done this or something very similar I would appreciate it a whole lot. Thank you!!!=)Tags: None
-
Hello Chrinist,
You can consider using the market analyzer. You can set alerts off "Last Price" with no programming required. Right click in the market analyzer window and select Columns. Select the last price column and then click the three dots next to "Alert conditions." Click new to create a new alert. Select the operator (equals, greater than, less than, not equal) under Condition and then type the value you want to be alerted for.
The following link walks you through setting up an alert condition through the market analyzer.
If you want to get started with NinjaScript, using the strategy wizard is a good place to start for generating conditions and actions. Setting alerts is one of several prebuilt action for strategies. Help guide article below is on using the condition builder for price data comparisons.
You should start with creating simple alerts like Close[0] > 1.3050 to see how it works. Then work on defining your rules objectively and you'll be able to create more advanced conditions.Ryan M.NinjaTrader Customer Service
-
Hi, Thanks for the fast reply, I still havent gotten it figured out but I guess Ill keep messing around with it until I do. I was wondering, with the market analyzer, can you add arrows on the chart or is it only audio alerts? For example, if the price goes down 10 pips, can I add a down arrow or if it goes up 10 pips can I add a up arrow?
Comment
-
ok Below is an example of what Im trying to do but since Im not a programmer I cant figure out what is going on and why its not showing up on my charts??? I am trying to get the high of a price movement and when the price drops down 10 pips from that top, place a red down arrow, and visa versa for a up arrow, when the price hits a bottom, and goes up 10 pips it places a green up arrow??? Why wont it work LOL This is why I have a great deal of respect for the computer programmers out there in our world. You guys are the best. BTW I used 1 WMA as my price line, so thats why I added the WMA into the equation.
#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.Indicator
{
/// <summary>
/// Im so tired
/// </summary>
[Description("Im so tired")]
public class ab : Indicator
{
#region Variables
// Wizard generated variables
private int tired = 1; // Default setting for Tired
// 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()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (WMA(1)[0] > Low[1] + 10 * TickSize)
{
DrawDot("My dot" + CurrentBar, false, 0, 0, Color.Green);
}
if (WMA(1)[0] < High[1] + 10 * TickSize)
{
DrawDot("My dot" + CurrentBar, false, 0, 0, Color.Red);
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int Tired
{
get { return tired; }
set { tired = Math.Max(1, value); }
}
#endregion
}
}
Comment
-
Hi there, you aren't seeing the dots because they are being placed at a price of 0. Also, you should specify different tags for different drawing objects (like "red dot" instead of "my dot").
If you change the second 0 to a price near where the market is trading, you will see the dots:
Code:DrawDot("My dot" + CurrentBar, false, 0, Low[0] - 2 * TickSize, Color.Green);
AustinNinjaTrader Customer Service
Comment
-
Ok I dont know if Im getting closer or if Im still not getting it? I was able to put one green dot on my screen but it still isnt calculating it correctly. Below is my code and I dont know what Im typing in wrong that the computer wont recognize what I need to be computed.
BTW all the ninja trader people that have taken time to help a newbie out, I really appreciate it a whole lot. You guys are really great and Im really starting to learn a lot from your guys tips. Thank you again for the past responces.
LOL ok How do I set a Dot(any color I dont care) to be put on the screen when the price goes 10 pips from a bottom??? Here is my code below and maybe anyone out there can show me what I typed in wrong. At this point I was able to get one dot to show but it wasnt even correct in its placement. There were dozens of spots where the 10 pip priced moved from a top or bottom and nothing happened. Again, Im really sorry for all this, Im just not a programmer so Im learning as I go and boy, I can understand why programmers get paid good money
Heres the 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.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>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class abc : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// 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()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Open[0] > Low[1] + 10 * TickSize)
{
DrawDot("BUY" + CurrentBar, false, 0, Low[0] + 0 * TickSize, Color.Green);
}
// Condition set 2
if (Open[0] < High[1] + 10 * TickSize)
{
DrawDot("SELL" + CurrentBar, false, 0, High[0] + 0 * TickSize, Color.Red);
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}Last edited by chrinist; 03-28-2010, 12:10 AM.
Comment
-
Hi
In
Code:if (Open[0] > Low[1] + 10 * TickSize) { DrawDot("BUY" + CurrentBar, false, 0, Low[0] + 0 * TickSize, Color.Green); }
TimNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Tim View PostHi
In
Code:if (Open[0] > Low[1] + 10 * TickSize) { DrawDot("BUY" + CurrentBar, false, 0, Low[0] + 0 * TickSize, Color.Green); }
Comment
-
Ok I tried editing my code with the following code below and it still doesnt work correctly. I cant even get it to compile now for some reason. The error codes Im getting is as follows: BTW I named the strategy abc just because Im learning this language and I have to start with the abc's
Strategy\abc.cs ; expected CS1002
I have put ; every which possible way I can think of and I still come up with this error message. Is there an easier way to program this strategy that I am trying to come up with or is my programming the most logical way to approach this type of a problem? LOL This is frustrating. will include the code that I currently have now so you can actually see the whole code that I am working on, this is with the modification that ninjatrader Tim recommended to me. Maybe I'm not seeing something right here.
Originally posted by NinjaTrader_Tim View PostHi chrinist,
You can do something like...
if (Close[0] > Low[1] + 10 * TickSize)
or
if (High[0] > Low[1] + 10 * TickSize)
or
if (Low[0] > Low[1] + 10 * TickSize)
#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>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class abc : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// 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()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if (Close[0] > Low[1] + 10 * TickSize)
or
if (High[0] > Low[1] + 10 * TickSize)
or
if (Low[0] > Low[1] + 10 * TickSize)
{
DrawDot("BUY" + CurrentBar, false, 0, High[1] + 0 * TickSize, Color.Green);
}
// Condition set 2
if (Close[0] < High[1] + 10 * TickSize)
or
if (High[0] < High[1] + 10 * TickSize)
or
if (Low[0] < High[1] + 10 * TickSize)
{
DrawDot("SELL" + CurrentBar, false, 0, Low[1] + 0 * TickSize, Color.Red);
}
}
#region Properties
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment
-
chrinist, the logical OR would be || in C# / NinjaScript so this below should compile -
Code:// Condition set 1 if ((Close[0] > Low[1] + 10 * TickSize) || (High[0] > Low[1] + 10 * TickSize) || (Low[0] > Low[1] + 10 * TickSize)) { DrawDot("BUY" + CurrentBar, false, 0, High[1] + 0 * TickSize, Color.Green); }
BertrandNinjaTrader Customer Service
Comment
-
Ok guys, Again, no go on the indicator. This is the problem Im running into at the moment, I have the indicator being compiled now with no error messages popping up and it seems to work fine, except.....There is nothing being drawn on the screen at all. Here is an example of the code I have being run right now since this was the recommendation of the ninjatrader help team, which I am very thankful for=), Is there anyway else to get the dots to appear after a high or low? For example, I just want to calculate a previous low and add 10 pips from that low and draw a dot. Then from a High, go down 10 pips and draw a dot, This alerts me that the market is moving. I have everything in place I think but no dots being drawn at the moment. Here is the code example below:
#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.Indicator
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class abc : Indicator
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// 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()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// Condition set 1
if ((Close[0] > Low[1] + 10 * TickSize)
||
(High[0] > Low[1] + 10 * TickSize)
||
(Low[0] > Low[1] + 10 * TickSize)
||
(Open[0] > Low[1] + 10 * TickSize))
{
DrawDot("BUY" + CurrentBar, false, 0, High[0] + 0 * TickSize, Color.Green);
}
// Condition set 2
// Condition set 1
if ((Close[0] < High[1] + 10 * TickSize)
||
(High[0] < High[1] + 10 * TickSize)
||
(Low[0] < High[1] + 10 * TickSize)
||
(Open[0] < High[1] + 10 * TickSize))
{
DrawDot("SELL" + CurrentBar, false, 0, Low[0] + 0 * TickSize, Color.Green);
}
}
Comment
-
Hello Chrinist,
There are a couple reasons why yours isn't plotting. First thing you should do is add the following statement, below the opening bracket { of OnBarUpdate() method.
if (CurrentBar < 1)
return;
See here for more information on why this is needed.
You can also see this article on debugging your code. It will assist you in using Print() statements so you can check that values are what you expect.Ryan M.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment