Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Running script and the Strategy Analyzer
Collapse
X
-
Running script and the Strategy Analyzer
I am currently running the Strategy Analyzer and want to continue working on another script but when I enable another Strategy it keeps switching itself off. Is this normal behaviour as the Analyser is running? -
Ya I see it. Its an error running my script.
Error on calling 'OnBarUpdate' method for strategy 'PivotTrader/090cbfc51f4247be961c84b3ad775753': PivotTrader.DrawLine: startTime must be greater/equal the minimum date but was 01-Jan-01 12:00:00 AM
This is the code,
protected override void OnBarUpdate()
{
if(CurrentBars[1] == 0)
return;
if (Bars.FirstBarOfSession)
Bars.Session.GetNextBeginEnd(BarsArray[1], 1, out sessionBegin, out sessionEnd);
// Calculate Pivot Points
pp = (Highs[1][1] + Lows[1][1] + Closes[1][1])/3;
DrawLine("pp" + CurrentBars[1], false, sessionBegin, pp, sessionEnd, pp, Color.Red, DashStyle.Solid,1);
Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd + pp);
Should I post it in the Programming forum for help?
Comment
-
-
Strategy analyser from 7th Dec 07 and Days to load is 735 on the chart.Last edited by GKonheiser; 10-21-2013, 01:02 PM.
Comment
-
Hello GKonheiser,
Thank you for your response.
What Session Template is being used for the strategy?
Can you attach your code to your response so I may investigate this matter further?
You will find your strategy located in the following directory on your PC: (My) Documents\NinjaTrader 7\bin\Custom\Strategy
If you prefer you can send your strategy to support[at]ninjatrader[dot]com with 'ATTN: Patrick - 938891' in the subject line and a reference to this thread in the body of the e-mail: http://www.ninjatrader.com/support/f...ad.php?t=61520
Comment
-
Here is the code:-
#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 PivotTrader : Strategy
{
#region Variables
private double r2;
private double r1;
private double pp;
private double s1;
private double s2;
private DateTime sessionBegin;
private DateTime sessionEnd;
#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()
{
Add(PeriodType.Day, 1);
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if(CurrentBars[1] == 0)
return;
if (Bars.FirstBarOfSession)
Bars.Session.GetNextBeginEnd(BarsArray[1], 1, out sessionBegin, out sessionEnd);
// Calculate Pivot Points
pp = (Highs[1][1] + Lows[1][1] + Closes[1][1])/3;
DrawLine("pp" + CurrentBars[1], false, sessionBegin, pp, sessionEnd, pp, Color.Red, DashStyle.Solid,1);
Print("Session Start: " + sessionBegin + " Session End: " + sessionEnd + pp);
}
}
}
Session template is Eurex Fixed Income Futures
Comment
-
Sorry if I was unclear. I am running the optimizer on one Script from dec 07 to dec 09 and I'm working on a second script applying to a chart of 2 year of data. But it doesn't matter what I apply the second strategy too, as long as the optimizer is running it automatically disables the strategy.
Comment
-
Hello GKonheiser,
Thank you for your response.
I see the same behavior when running a backtest and then enabling my strategy on the Strategies tab, however this only occurs if I click to enable the strategy and then click within the Strategies tab on the Control Center even on a different region of the window.
For this not to happen you would need to click outside the Control Center window after checking the option for enable on the strategy.
I will investigate this matter further on my end and follow up with you on any additional information I have.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
14 responses
1,788 views
0 likes
|
Last Post
by aligator
Today, 11:47 AM
|
||
Started by Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
837 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,293 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
||
Started by Touch-Ups, Today, 10:36 AM
|
0 responses
12 views
0 likes
|
Last Post
by Touch-Ups
Today, 10:36 AM
|
||
Started by geddyisodin, 04-25-2024, 05:20 AM
|
11 responses
62 views
0 likes
|
Last Post Today, 10:08 AM |
Comment