NexusFi: Find Your Edge


Home Menu

 





limit e-mail alerts


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sam028 with 1 posts (0 thanks)
    2. looks_two rleplae with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Jorma with 1 posts (0 thanks)
    1. trending_up 1,145 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

limit e-mail alerts

  #1 (permalink)
 Jorma 
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 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];

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 NT7
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

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


What is the exact logic to fire the email ?

In big lines what you need to do :

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)

hope this helps you

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Jorma View Post
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:
...

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.

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote




Last Updated on March 3, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts