Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Hello All. I have a indicator on easylanguage. I want to implement it on ninjasript. In the picture of his project.
He draws a horizontal line on the closing price of each bar. The horizontal line is displayed until it intersects the price of a certain number of times.
First, I tried to display a horizontal line at each price:
I could not get.
Please advise how I can do it, and how to work with the horizontal line tag, to appeal to her?
Thank.
Can you help answer these questions from other members on NexusFi?
At the moment my brain was able to generate the code. It compiles, but does not bring results, draws only one line. Maybe I need another array of lines? I will be happy with any prompts.
It draws one line because you are erasing it with RemoveDrawObject.
DrawHorizontalLine draws a line extended to infinity in both left and right directions. It looks to me like you want to draw a finite line that stops after some number of price intersections.
I'd do something like this. In region "Using declarations" at the top, add
using System.Collections.Generic; // add array list capability
Then create an array list to store your lines:
Warning, the above is from my head, untested. But it should give you an idea how to proceed.
-A
You don't need a thick book. Whenever I have a C# question, I just Google it, and most often I end up reading pages on Microsoft's online library. The List class is documented here, for example. A List in C# is simply an array of any data type; in the code above I made up a custom struct to hold data about each horizontal line, and created a List array of them. An array implemented as a List has variable length controlled by the Add() and Remove() methods. You can get the number of array elements at any time using the Count() method, and you can access elements in the array as a[0], a[1], etc. just like a conventional array.
anachronist, I tried to compile your code from all the mistakes I do not understand only one: when referring to linedata.value CS0122 is inaccessible due to its protection level, the rest will deal less. Or maybe advise me what is the documentation of: protection level.
Eh, sorry about that. The word "public" must precede the declaration of "double value" in the struct definition. I'll correct it in my reply above. I think everything defaults to "private" in C# unless you explicitly declare it otherwise.
(Private properties in structs make no sense at all, so the default makes no sense, but that's a philosophical topic best discussed in another forum.)
-A