NinjaTrader Support Forum  
X

Attention!

This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com


Go Back   NinjaTrader Support Forum > Application Technical Support > Automated Trading

Automated Trading Support for automated trading systems using NinjaScript. Support for our ATI (Automated Trading Interface) used to link an external application such as TradeStation and eSignal to NinjaTrader.

Reply
 
Thread Tools Display Modes
Old 08-03-2012, 11:52 AM   #1
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default autostrategy for time of day buys and sells

I couldn't find the information on vids on how to set up a strategy using just time of day? I have tried a couple of different approaches but everytime I try and activate the conditions box. The box doesn't load.
I don't want to use any indicators - I just want to buy a group of futures near 4pm and sell them at 7:30am.
Would someone be willing to post a tutorial or screen shots to get me started.
Thanks,
Mike
gonetowindsurf is offline  
Reply With Quote
Old 08-03-2012, 12:04 PM   #2
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello Mike,
Welcome to the forum and I am happy to assist you.

You can compare the bar time to filter your trading time. Unfortunately there are no videos but you can refer to this sample code which further illustrates it.
http://ninjatrader.com/support/forum...ead.php?t=3226

Please let me know if I can assist you any further.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-07-2012, 12:47 PM   #3
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default errors in code

Hi Joy,
I downloaded the zip file but when I went to import it into my strategy I got a message telling me it had errors in it that need to be fixed. Suggestions?
thanks mike
gonetowindsurf is offline  
Reply With Quote
Old 08-07-2012, 01:00 PM   #4
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello gonetowindsurf
Thank you for writing in.

Please follow the instructions below to see where the errors are coming from after compiling the indicator. This will allow you to debug the indicator/strategy or remove it from your PC. If you are wondering why you receive an error when compiling only one indicator, it is because NinjaTrader compiles all indicators and strategies- not just one.
• Open NinjaTrader
• From the Control Center select the Tools menu--> select the Edit NinjaScript menu item--> select Indicator
• Select an indicator and double click on it.
• A new window will appear and you will need to right click in the window and select Compile to compile the indicators.
• At the bottom of the window a new section will appear where you can find the error locations.
• From there you have the option to remove the indicator or debug it.

Here is a video of this process:
http://screencast.com/t/K3plVBblUy
Also here is a forum post that describes the process and offers ways to resolve the situation:
http://www.ninjatrader.com/support/f...ead.php?t=4678

If you are unsure as to what the error is indicating, please send me a screenshot of the error with the name and description fields clearly readable.
To send a screenshot press Alt + PRINT SCREEN to take a screen shot of the selected window. Then go to Start--> Accessories--> Paint, and press CRTL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.

Please let me know if I can provide any further assistance.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-07-2012, 03:40 PM   #5
mhaus
Junior Member
 
Join Date: Mar 2012
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
Default

Ninja_Support, please correct me if I am wrong.
In your strategy, under the OnBarUpdate() section, you can have something like this

if (ToTime(Time[0]) == ToTime(15, 55, 0))
{
// Buy a group of futures

}

if (ToTime(Time[0]) == ToTime(7, 30, 0) )
{
// Sell the group of futures

}
mhaus is offline  
Reply With Quote
Old 08-07-2012, 04:22 PM   #6
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default How about this?

Hi Joy,
I am going to just delete all the sample strategies and reload the download you provided. They are just sample scripts that I have no use for - make sense?
mike
gonetowindsurf is offline  
Reply With Quote
Old 08-07-2012, 04:32 PM   #7
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default well that didn't work

Apparently I cannot delete a strategy until i fix the error? It would be simpler just to punt it - not sure i reeeeely want to try and figure out an error - would rather just start from jump again - no? I am not the sharpest tool in the shed. Is there annny other way other than trying to find an error?
mike
gonetowindsurf is offline  
Reply With Quote
Old 08-07-2012, 04:38 PM   #8
marcow
Senior Member
 
Join Date: Dec 2009
Location: Netherlands
Posts: 179
Thanks: 15
Thanked 72 times in 51 posts
Default

Quote:
• Open NinjaTrader
• From the Control Center select the Tools menu--> select the Edit NinjaScript menu item--> select Indicator
• Select an indicator and double click on it.
• A new window will appear and you will need to right click in the window and select Compile to compile the indicators.
• At the bottom of the window a new section will appear where you can find the error locations.
can you post a picture of your screen after compiling a random indicator ?

Marco
marcow is offline  
Reply With Quote
Old 08-07-2012, 04:40 PM   #9
marcow
Senior Member
 
Join Date: Dec 2009
Location: Netherlands
Posts: 179
Thanks: 15
Thanked 72 times in 51 posts
Default

Mike,

I also got the impression you were using the StrategyWizard to create your strategy, aren't you ?
Just making sure we're not bombarding you with all sorts of C# code which you aren't familiar with.

Marco
marcow is offline  
Reply With Quote
Old 08-07-2012, 09:20 PM   #10
mhaus
Junior Member
 
Join Date: Mar 2012
Posts: 2
Thanks: 0
Thanked 0 times in 0 posts
Default

Mike, you must delete the strategy or indicator that gave you the error while compiling, first. The way to do that is go to Tools -> Edit NinjaScript -> Strategy. You will see a list of strategies. Select the strategy that is giving you the error and click "Delete". After deleting the script, you then click "Cancel" to get out of the Edit Ninjascript menu. Once you delete the script that gave you the error, you would be able to compile other scripts.

Hope this helps.
mhaus is offline  
Reply With Quote
Old 08-08-2012, 04:25 AM   #11
NinjaTrader_Joydeep
NinjaTrader Customer Service
 
NinjaTrader_Joydeep's Avatar
 
Join Date: Dec 2011
Location: India
Posts: 3,286
Thanks: 580
Thanked 546 times in 541 posts
Default

Hello gonetowindsurf,
So that I can assist you further can you send a contact number to support[AT]ninjatrader[DOT]com


Please append Attn:Joydeep in the subject line of the email and give a reference of this thread in the body of the email.



@mhaus Yes, you can have that code on OnBarUpdate.
NinjaTrader_Joydeep is offline  
Reply With Quote
Old 08-08-2012, 02:03 PM   #12
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default Here is my error message - i also have a gazillion codes that are incorrect

#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// Enter the description of your strategy here
/// </summary>
[Description("Enter the description of your strategy here")]
public class overnight : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
}

#region Properties
#endregion
}
}

#region Wizard settings, neither change nor remove
/*@
<?xml version="1.0" encoding="utf-16"?>
<NinjaTrader>
<Name>overnight</Name>
<CalculateOnBarClose>False</CalculateOnBarClose>
<Description>Enter the description of your strategy here</Description>
<Parameters />
<State>
<CurrentState>
<StrategyWizardState xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Name>Flat</Name>
<Sets>
<StrategyWizardStateSet>
<Actions />
<Conditions />
</StrategyWizardStateSet>
</Sets>
<StopTargets />
</StrategyWizardState>
</CurrentState>
</State>
</NinjaTrader>
@*/
#endregion
gonetowindsurf is offline  
Reply With Quote
Old 08-08-2012, 02:05 PM   #13
gonetowindsurf
Junior Member
 
Join Date: Aug 2012
Posts: 10
Thanks: 0
Thanked 1 time in 1 post
Default When in doubt - reload

I am going to uninstall and then re install and see if i can start fresh -
gonetowindsurf is offline  
Reply With Quote
Old 08-08-2012, 02:06 PM   #14
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,498
Thanks: 109
Thanked 291 times in 280 posts
Default

Please email us at support if you need further assistance on this.

-Brett
NinjaTrader_Brett is offline  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Buys and Sells not matching in number richwaters Strategy Development 3 02-23-2011 04:46 AM
Plotting Buys & Sells Crumbs Automated Trading 7 01-19-2010 06:11 PM
Changing timeframe loses buy/sells theoracle Strategy Analyzer 1 12-21-2008 02:43 PM
Plotting Buys and Sells on chart SystemTrading General Programming 1 10-21-2008 07:03 AM
resetting flag at end of day or a certain time of day sauer11155 Strategy Development 5 09-23-2008 08:30 AM


All times are GMT -6. The time now is 02:32 AM.