PDA

View Full Version : Time parameters to alert


simpletrades
01-13-2010, 09:49 AM
I'm trying to be able to have my alerts go off only between certain hours so I can keep from being distracted when i dont want to be trading.

if (CrossAbove(DiMinus, 20, 1) && DiMinus[0]>=DiPlus[0] && (ToTime(Time[0]) >= time1 )) Alert.......

This is what I have done.
time1 is defined in variables as private int time1 = 1159; (so I can test it since its just after 1130 now)

and in properties as:
[Description("time threshhold")]
[Category("Parameters")]
public int Time1
{
get { return time1; }
set { time1 = Math.Max(1, value); }
}

but the alerts go off anyhow. why? Does totime need to be defined somehow somewhere?

NinjaTrader_RyanM
01-13-2010, 10:01 AM
Hello Simpletrades,

Thank you for your post

You should be able to do this by adding seconds to your time1 variable. So 11:59 should be 115900

simpletrades
01-13-2010, 10:06 AM
I'm trying to be able to have my alerts go off only between certain hours so I can keep from being distracted when i dont want to be trading.

if (CrossAbove(DiMinus, 20, 1) && DiMinus[0]>=DiPlus[0] && (ToTime(Time[0]) >= time1 )) Alert.......

This is what I have done.
time1 is defined in variables as privateint time1 = 1159; (so I can test it since its just after 1130 now)

and in properties as:
[Description("time threshhold")]
[Category("Parameters")]
publicint Time1
{
get { return time1; }
set { time1 = Math.Max(1, value); }
}

but the alerts go off anyhow. why? Does totime need to be defined somehow somewhere?

i read your post, changed it to 123000 and hit apply on the indicator on the chart just in time for an alert to trigger but this time it plotted silently. thanks.

simpletrades
01-13-2010, 10:11 AM
Hello Simpletrades,

Thank you for your post

You should be able to do this by adding seconds to your time1 variable. So 11:59 should be 115900

is the proper way to set it to always trigger is use 000100 as 1 minute past midnite?

NinjaTrader_RyanM
01-13-2010, 10:20 AM
Yes, this is the correct way to represent 1 minute past midnight, but the leading zeroes aren't necessary. 100 will do the same thing.