Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
this the program of my indicator and i want to receive 1 or 2 mails per bar, no more.
I asked in ninjatrader forum and they told me this:
Declare an integer variable. Have this variable reset to 0 on the first tick of the bar. Where you have the alert / email, add a condition that checks the value of the integer variable being under how many alerts / emails you want. Increment the integer variable each time the alert / email is triggered.
In your alert call, be sure to set the rearmSeconds to a value above 0, and to a comfortable level.
but i don' t know how to do this.
//
// Copyright (C) 2006, NinjaTrader LLC <[email protected]>.
// NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.
//
#region Using declarations
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion
#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private RMO[] cacheRMO = null;
private RMOarrowColor[] cacheRMOarrowColor = null;
private RMOlowerStraight[] cacheRMOlowerStraight = null;
private static RMO checkRMO = new RMO();
private static RMOarrowColor checkRMOarrowColor = new RMOarrowColor();
private static RMOlowerStraight checkRMOlowerStraight = new RMOlowerStraight();
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
public RMO RMO(int length, int rmoLength, bool showRMO, int swingTrdLen)
{
return RMO(Input, length, rmoLength, showRMO, swingTrdLen);
}
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
public RMO RMO(Data.IDataSeries input, int length, int rmoLength, bool showRMO, int swingTrdLen)
{
if (cacheRMO != null)
for (int idx = 0; idx < cacheRMO.Length; idx++)
if (cacheRMO[idx].Length == length && cacheRMO[idx].RmoLength == rmoLength && cacheRMO[idx].ShowRMO == showRMO && cacheRMO[idx].SwingTrdLen == swingTrdLen && cacheRMO[idx].EqualsInput(input))
return cacheRMO[idx];
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public RMOarrowColor RMOarrowColor(string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
return RMOarrowColor(Input, alertSound, emailFrom, emailTo, length, rmoLength, separation, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public RMOarrowColor RMOarrowColor(Data.IDataSeries input, string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
if (cacheRMOarrowColor != null)
for (int idx = 0; idx < cacheRMOarrowColor.Length; idx++)
if (cacheRMOarrowColor[idx].AlertSound == alertSound && cacheRMOarrowColor[idx].EmailFrom == emailFrom && cacheRMOarrowColor[idx].EmailTo == emailTo && cacheRMOarrowColor[idx].Length == length && cacheRMOarrowColor[idx].RmoLength == rmoLength && cacheRMOarrowColor[idx].Separation == separation && cacheRMOarrowColor[idx].SwingTrdLen == swingTrdLen && cacheRMOarrowColor[idx].EqualsInput(input))
return cacheRMOarrowColor[idx];
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public RMOlowerStraight RMOlowerStraight(int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
return RMOlowerStraight(Input, length, rmoLength, separation, showLabel, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public RMOlowerStraight RMOlowerStraight(Data.IDataSeries input, int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
if (cacheRMOlowerStraight != null)
for (int idx = 0; idx < cacheRMOlowerStraight.Length; idx++)
if (cacheRMOlowerStraight[idx].Length == length && cacheRMOlowerStraight[idx].RmoLength == rmoLength && cacheRMOlowerStraight[idx].Separation == separation && cacheRMOlowerStraight[idx].ShowLabel == showLabel && cacheRMOlowerStraight[idx].SwingTrdLen == swingTrdLen && cacheRMOlowerStraight[idx].EqualsInput(input))
return cacheRMOlowerStraight[idx];
// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMO RMO(int length, int rmoLength, bool showRMO, int swingTrdLen)
{
return _indicator.RMO(Input, length, rmoLength, showRMO, swingTrdLen);
}
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
public Indicator.RMO RMO(Data.IDataSeries input, int length, int rmoLength, bool showRMO, int swingTrdLen)
{
return _indicator.RMO(input, length, rmoLength, showRMO, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMOarrowColor RMOarrowColor(string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
return _indicator.RMOarrowColor(Input, alertSound, emailFrom, emailTo, length, rmoLength, separation, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.RMOarrowColor RMOarrowColor(Data.IDataSeries input, string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
return _indicator.RMOarrowColor(input, alertSound, emailFrom, emailTo, length, rmoLength, separation, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMOlowerStraight RMOlowerStraight(int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
return _indicator.RMOlowerStraight(Input, length, rmoLength, separation, showLabel, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.RMOlowerStraight RMOlowerStraight(Data.IDataSeries input, int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
return _indicator.RMOlowerStraight(input, length, rmoLength, separation, showLabel, swingTrdLen);
}
}
}
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMO RMO(int length, int rmoLength, bool showRMO, int swingTrdLen)
{
return _indicator.RMO(Input, length, rmoLength, showRMO, swingTrdLen);
}
/// <summary>
/// RMO Indicator
/// </summary>
/// <returns></returns>
public Indicator.RMO RMO(Data.IDataSeries input, int length, int rmoLength, bool showRMO, int swingTrdLen)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMOarrowColor RMOarrowColor(string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
return _indicator.RMOarrowColor(Input, alertSound, emailFrom, emailTo, length, rmoLength, separation, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.RMOarrowColor RMOarrowColor(Data.IDataSeries input, string alertSound, string emailFrom, string emailTo, int length, int rmoLength, int separation, int swingTrdLen)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.RMOlowerStraight RMOlowerStraight(int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
return _indicator.RMOlowerStraight(Input, length, rmoLength, separation, showLabel, swingTrdLen);
}
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.RMOlowerStraight RMOlowerStraight(Data.IDataSeries input, int length, int rmoLength, int separation, bool showLabel, int swingTrdLen)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
1) you need to make sure your indicator is called not only on bar close, if you want the logic to be triggered more than once a bar (onbarclose = false)
2) you will have to keep track and see if a new bar was formed
3) upon trigger condition create email (sendmail) and put a flag (maildone =1)
4) reset the flag on a new bar (maildone =0)
The code provided seems to be the Ninja generated part, not the indicator itself: no Initialize(), no OnBarUpdate(), ...
We can't do anything without the source, the code provided here is useless.