I am currently trying to add time to time. For the purpose of not trading the first cross below but, waiting for a period of time and trading the second cross belowr if it takes place a certain time after the first cross below.
I have been trying to utilise the code from
but have not been able to get the code to work as yet.
I was just wondering if someone would be able to offer any thoughts as to the mistake that is being made.
The number 1000 was used to try and add 10 minutes to the time integer.
Many thanks in advance for any help
4blue
#region Variables
int TimeOfFirstCrossOver;
int TimeOfAllowedCrossOver;
int TimeOfAllowedCrossOverTwo;
#endregion
protected override void OnBarUpdate()
TimeOfAllowedCrossOver = TimeOfFirstCrossOver + 1000;
if (TimeOfAllowedCrossOver % 10000 > 5959)
{
TimeOfAllowedCrossOverTwo = 10000*Math.Round(((TimeOfAllowedCrossOver)/10000),0);
}
// Condition set 1
if (set of conditions == true)
{
TimeOfFirstCrossOver = ToTime(Time[0]);
}
// Condition set 2
if (set of conditions == true
&& ToTime(Time[0]) >= TimeOfFirstCrossOver)
{
EnterLong(DefaultQuantity, "long 1");
}
Comment