Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
NOOB: Info on buy/sell order for EOD data
Collapse
X
-
If you want to use an int please use an IntSeries. Same exact concept as DataSeries. http://www.ninjatrader-support.com/H...riesClass.htmlJosh P.NinjaTrader Customer Service
Comment
-
But i dont want the array to contain any bar data. I just want a simpe array that contains different int values that has nothing to do with the current bar chart. The references you sent me bouth state "that holds a series of int values and ALWAYS contains the same number of elements as bars in a chart". So it is not possible to use standard C# arrays in NT?
My second question is if there is a indicator for historical volatility in NT? Cant find any info in the help files. I did find this old thred
but there is no one from NT that has comented if the indicator is exact or if it has any errors?
Comment
-
Man this is not my day I have a sterategy that has errors in it but now i want to start making an indicator. However when i am compiling the indicator i get errors from that strategy. Why is that i just want to compile the indicator and i dont want to do anything with the strategy.
Comment
-
zwoop,
All NinjaScript files compile at the same time when you press compile. They all need to be error free. If you don't want to finish working on an unfinished work before starting on a different you can comment out all the uncompilable lines to let it compile and then let you work on your indicators.
If you want a C# array you will then have to use the C# techniques for achieving this. Unfortunately this is outside of what we can cover. I suggest you try searching on google for some resources on how they do it though.Josh P.NinjaTrader Customer Service
Comment
-
My second question is if there is a indicator for historical volatility in NT? Cant find any info in the help files. I did find this old thred
http://www.ninjatrader-support2.com/...cal+Volatility
but there is no one from NT that has comented if the indicator is exact or if it has any errors?
The way i have made the array is the standard C# way that is why im puzzled when i get the error
Comment
-
#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 Test1 : Strategy
{
#region Variables
// Wizard generated variables
private int myInput0 = 1; // Default setting for MyInput0
// User defined variables (add any user defined variables below)
int upp=new int[60], down=new int[60], unChanged=new int[60];
#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()
{
ClearOutputWindow();
CalculateOnBarClose = true;
BarsRequired=3;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
UppUpp();
DownUpp();
UppDown();
DownDown();
//DownDownDown();
}
private void UppUpp(){
if(Close[1]>Close[2] && Open[0]>Close[1])
if(Close[0]>Open[0])
upp[0]++;
else if(Close[0]<Open[0])
down[0]++;
else
unChanged[0]++;
if (Bars.CurrentBar == Bars.Count-2)
Print("++ UPP: "+ (upp[0]/(upp[0]+down[0]+unChanged[0])*100).ToString("N0") +"% Down: "+ (down[0]/(upp[0]+down[0]+unChanged[0])*100).ToString("N0") +"%");
}
private void DownUpp(){
if(Close[1]<Close[2] && Open[0]>Close[1])
if(Close[0]>Open[0])
upp[1]++;
else if(Close[0]<Open[0])
down[1]++;
else
unChanged[1]++;
if (Bars.CurrentBar == Bars.Count-2)
Print("++ UPP: "+ (upp[1]/(upp[1]+down[1]+unChanged[1])*100).ToString("N0") +"% Down: "+ (down[1]/(upp[1]+down[1]+unChanged[1])*100).ToString("N0") +"%");
}
private void UppDown(){
if(Close[1]>Close[2] && Open[0]<Close[1])
if(Close[0]>Open[0])
upp[2]++;
else if(Close[0]<Open[0])
down[2]++;
else
unChanged[2]++;
if (Bars.CurrentBar == Bars.Count-2)
Print("++ UPP: "+ (upp[2]/(upp[2]+down[2]+unChanged[2])*100).ToString("N0") +"% Down: "+ (down[2]/(upp[2]+down[2]+unChanged[2])*100).ToString("N0") +"%");
}
private void DownDown(){
if(Close[1]<Close[2] && Open[0]<Close[1])
if(Close[0]>Open[0])
upp[3]++;
else if(Close[0]<Open[0])
down[3]++;
else
unChanged[3]++;
if (Bars.CurrentBar == Bars.Count-2)
Print("++ UPP: "+ (upp[3]/(upp[3]+down[3]+unChanged[3])*100).ToString("N0") +"% Down: "+ (down[3]/(upp[3]+down[3]+unChanged[3])*100).ToString("N0") +"%");
}
private void DownDownDown(){
}
#region Properties
[Description("")]
[Category("Parameters")]
public int MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment
-
zwoop, unfortunately we can't debug those C# methods for you, however you can take a look at this thread here members discussed related topics providing valuable insight into using arrays / arraylists in C# - http://www.ninjatrader-support2.com/...ad.php?t=24801BertrandNinjaTrader Customer Service
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Wessel, 03-23-2024, 02:37 PM
|
3 responses
21 views
0 likes
|
Last Post Today, 04:58 PM | ||
Started by martini, Yesterday, 04:45 PM
|
4 responses
30 views
0 likes
|
Last Post
by martini
Today, 04:48 PM
|
||
Started by catinabag, 04-13-2023, 05:46 AM
|
34 responses
1,459 views
0 likes
|
Last Post
by mcosta72
Today, 04:44 PM
|
||
Started by adeelshahzad, Today, 11:49 AM
|
6 responses
23 views
0 likes
|
Last Post
by mcosta72
Today, 04:35 PM
|
||
Started by sidlercom80, 05-05-2020, 07:20 AM
|
4 responses
304 views
0 likes
|
Last Post
by Bidder
Today, 04:35 PM
|
Comment