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
Loop Logic and Dataseries
Collapse
X
-
Tags: None
-
-
Hello stockgoblin,
Thanks for the code.
So I've put this in an indicator and run it. I also added some print statements so I can see the values the conditions are based on. I notice that the draw does not always happen but I am not sure when it is suppose to happen.
Currently the code reads as this:
Calculate the difference (subtraction) of the close of the current bar and the close of the last bar. Take this difference and set myDataseries[0] to this value.
Then loop over the current amount of bars from 0 up to 255.
During this loop, if the difference of the close of the current bar and close of the previous bar are equal to the difference value stored in the current iteration of myDataSeries then draw a line from 1 bar ago at the close price of 1 bar ago to the current bar at the current close (continuing because it is extended).
This can happen many times during that loop. This means there are going to be a lot of drawn lines.
Also, this will always draw on the first iteration of the loop. myDataSeries[0] == myDataSeries[0]. This will happen only once in that 256 iteration loop for every bar.
I don't quite understand what you are asking for when you say " all instances of parallel lines that are made from adjacent bar closes."
Does this mean that you would like to draw this line if the close of the previous bar is the same as the close of the current bar?
Or that you would like to draw this line if the close of the current bar is the same as the close as the 2 previous bars?
Just as a tip, you have the following code in your Initialize() function:
Code:for (int i = 0; i < 256; ++i) { myDataSeries = new DataSeries(this, MaximumBarsLookBack.Infinite); }
Please let me know and I will continue to assist.Chelsea B.NinjaTrader Customer Service
Comment
-
-
Ok, I got it.
Maybe this programming stuff isn't impossible to learn.
live logic & long prosperLast edited by stockgoblin; 03-25-2013, 04:43 PM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
7 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
||
Started by zstheorist, Yesterday, 07:52 PM
|
0 responses
7 views
0 likes
|
Last Post
by zstheorist
Yesterday, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
151 views
0 likes
|
Last Post
by rehmans
Yesterday, 06:44 PM
|
Comment