|
Versailles Ile de france France
Experience: Beginner
Platform: Sierra
Trading: Futures
Posts: 12 since Dec 2013
Thanks Given: 0
Thanks Received: 0
|
this the program of my indicator and i want to receive 1 or 2 mails per bar, no more.
I asked in 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 <ninjatrader.com>.
// 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];
lock (checkRMO)
{
checkRMO.Length = length;
length = checkRMO.Length;
checkRMO.RmoLength = rmoLength;
rmoLength = checkRMO.RmoLength;
checkRMO.ShowRMO = showRMO;
showRMO = checkRMO.ShowRMO;
checkRMO.SwingTrdLen = swingTrdLen;
swingTrdLen = checkRMO.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];
RMO indicator = new RMO();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Length = length;
indicator.RmoLength = rmoLength;
indicator.ShowRMO = showRMO;
indicator.SwingTrdLen = swingTrdLen;
Indicators.Add(indicator);
indicator.SetUp();
RMO[] tmp = new RMO[cacheRMO == null ? 1 : cacheRMO.Length + 1];
if (cacheRMO != null)
cacheRMO.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheRMO = tmp;
return indicator;
}
}
/// <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];
lock (checkRMOarrowColor)
{
checkRMOarrowColor.AlertSound = alertSound;
alertSound = checkRMOarrowColor.AlertSound;
checkRMOarrowColor.EmailFrom = emailFrom;
emailFrom = checkRMOarrowColor.EmailFrom;
checkRMOarrowColor.EmailTo = emailTo;
emailTo = checkRMOarrowColor.EmailTo;
checkRMOarrowColor.Length = length;
length = checkRMOarrowColor.Length;
checkRMOarrowColor.RmoLength = rmoLength;
rmoLength = checkRMOarrowColor.RmoLength;
checkRMOarrowColor.Separation = separation;
separation = checkRMOarrowColor.Separation;
checkRMOarrowColor.SwingTrdLen = swingTrdLen;
swingTrdLen = checkRMOarrowColor.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];
RMOarrowColor indicator = new RMOarrowColor();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.AlertSound = alertSound;
indicator.EmailFrom = emailFrom;
indicator.EmailTo = emailTo;
indicator.Length = length;
indicator.RmoLength = rmoLength;
indicator.Separation = separation;
indicator.SwingTrdLen = swingTrdLen;
Indicators.Add(indicator);
indicator.SetUp();
RMOarrowColor[] tmp = new RMOarrowColor[cacheRMOarrowColor == null ? 1 : cacheRMOarrowColor.Length + 1];
if (cacheRMOarrowColor != null)
cacheRMOarrowColor.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheRMOarrowColor = tmp;
return indicator;
}
}
/// <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];
lock (checkRMOlowerStraight)
{
checkRMOlowerStraight.Length = length;
length = checkRMOlowerStraight.Length;
checkRMOlowerStraight.RmoLength = rmoLength;
rmoLength = checkRMOlowerStraight.RmoLength;
checkRMOlowerStraight.Separation = separation;
separation = checkRMOlowerStraight.Separation;
checkRMOlowerStraight.ShowLabel = showLabel;
showLabel = checkRMOlowerStraight.ShowLabel;
checkRMOlowerStraight.SwingTrdLen = swingTrdLen;
swingTrdLen = checkRMOlowerStraight.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];
RMOlowerStraight indicator = new RMOlowerStraight();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
indicator.Length = length;
indicator.RmoLength = rmoLength;
indicator.Separation = separation;
indicator.ShowLabel = showLabel;
indicator.SwingTrdLen = swingTrdLen;
Indicators.Add(indicator);
indicator.SetUp();
RMOlowerStraight[] tmp = new RMOlowerStraight[cacheRMOlowerStraight == null ? 1 : cacheRMOlowerStraight.Length + 1];
if (cacheRMOlowerStraight != null)
cacheRMOlowerStraight.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheRMOlowerStraight = tmp;
return indicator;
}
}
}
}
// 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");
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)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
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)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");
return _indicator.RMOlowerStraight(input, length, rmoLength, separation, showLabel, swingTrdLen);
}
}
}
#endregion
|