View Full Version : time strategies
triphop
09-06-2007, 02:34 PM
I can't create a strategy (using the wizard) that refers to a time.
If I wanted to say, when time=9, place order, the wizard generates code that comes up with error:
Cannot apply indexing with [] to an expression of type 'method group' Strategy\ar3.cs 49 29
if (ToTime(Time[0]) == ToTime(21, 0, 0))
{
EnterShort(DefaultQuantity, "");
}
}
Is the wizard generating the right syntax?
Many thanks
NinjaTrader_Ray
09-06-2007, 02:53 PM
Can you provide exact steps on how to reproduce this?
Thanks in advance.
triphop
09-06-2007, 03:35 PM
Sure Ray,
In condition builder, on the left, select time series, on the right, select time value, and enter the time, eg 22:00
NinjaTrader_Ray
09-06-2007, 03:41 PM
Thanks.
We just released 6.0.1000.5, could you install this version and see if this problem goes away? I recall something similar that I believe we resolved.
To access the download, from within NT, select the menu Help > Download Site.
triphop
09-06-2007, 03:56 PM
Hmmm... just did and get the same code:
// Condition set 1
if (ToTime(Time[0]) == ToTime(22, 54, 6))
{
EnterLong(DefaultQuantity, "");
}
}
but the error message additionally says:
The left-hand side of an assignment must be a variable, property or indexer Strategy\brek3.cs 44 16
Am I doing this right?
NinjaTrader_Ray
09-06-2007, 03:59 PM
Thanks, we will look into this.
NinjaTrader_Josh
09-06-2007, 04:09 PM
In the meantime the proper syntax to check if time is 9am is this:
if (ToTime(Time[0]) == 90000)
This (http://www.ninjatrader-support.com/vb/showthread.php?t=3226) reference sample demonstrates some of the ToTime() manipulations which you may find useful.
NinjaTrader_Dierk
09-07-2007, 01:37 AM
I can't create a strategy (using the wizard) that refers to a time.
If I wanted to say, when time=9, place order, the wizard generates code that comes up with error:
Cannot apply indexing with [] to an expression of type 'method group' Strategy\ar3.cs 49 29
if (ToTime(Time[0]) == ToTime(21, 0, 0))
{
EnterShort(DefaultQuantity, "");
}
}
Is the wizard generating the right syntax?
Many thanks
Your code posted definitely compiles fine. Provided the error message you posted refers to the code lines you posted, I would think that your installation is screwed up.
Please try this:
- uninstall NT6
- uninstall .NET 2.0 framework
- install .NET 2.0 from here: http://www.microsoft.com/downloads/details.aspx?FamilyID=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en
- reinstall NT6