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)
Here you go. As you can see the translation is straightforward. C# is a bit verbose as it's a general purpose language so you have to follow its object oriented framework; but you will gain a lot in the future by using C#.
I tried to translate your EL code line by line without any change. So when I saw "High[1] - High[1]" was used in two places I also translated them without change but added comment wondering why you did this instead of just writing down 0 - could it be a typo, or you modified the script from something else into this?
EL result:
NET result:
The 2 screen shots show that my NET result matches your EL result. (I don't own MultiCharts standard version so I had to get a demo running on a Windows virtual machine to get EL result since demo on my physical machine has long expired ).
There might be minor differences around open and close because the data source is Interactive Brokers for EL and IQFeed for NET (cannot get 2 identical logins running simultaneously for either single data source).
Ah I see. That was me coding something and helping others, not me suggesting a trading approach. I think you're better off following the latest version posted by SPMC here:
I came up with another newbie question.I want to store some trendlinearray in an indicator ,which will be added manually time by time to use on different charts.But stuck ofcourse Here is what I got so far:
Don't know if the boolean is necessary at all , found it as an suggestion on tradingcode.net articles.
What am I doing wrong?
using System;
using System.Drawing;
using System.Linq;
using PowerLanguage.Function;
It's hard for me to tell what you're doing wrong here, since I don't get what you're trying to do. Perhaps an array with fixed values of 10000, 10050, and 10100 is a good idea, but it might also be a wrong approach to this problem.
I do know that you won't achieve your goal of 'added manually time by time to use on different charts'. That's because your `numbers` array is hardcoded, which doesn't make it manual and makes it the same on different charts.
That Boolean prevents the trend lines from being created with every script update. Currently, your script creates a trend line each each time `CalcBar()` executes. Even if you really wanted a new trend line drawn on every bar, this might give you troubles because there's a limit or 7,500 objects (see here), and that includes trend lines.
By the way, please read your code carefully because your for loop does the following:
That's probably not your intention with the code, I think.
sorry for my bad explanation .I want to collect horizontal trendlines ,which's price I can add manually.
This I tried with the array.Just keeping the prizes in this case and can be added with int[]numbers = new int [3]{10000,10050,10100};
Maybe there is a better solution , a list or sth similar.
ok then the boolean makes the code just print once - that's ok because it has not to be recalculated.
If I may observe something, then you're overcomplicating things with a `List<T>`. In your last script, you use a generic list and then store the list values into decimal variables. In that case you don't need a list at all, especially since there always seem to be at most 3 horizontal lines that you want to draw (if I understand correctly). It might simplify things a bit if you just use the three variables.
With other things you're oversimplifying, for instance:
This doesn't work that way; `CalcBar()` is executed on every bar, starting from the very first bar to the very last. Then, when there is real-time data, it's called on every tick (for strategies with intra-bar order generation and indicators set to 'update on every tick') or once per bar (for strategies without intra-bar generation and indicators with 'update on every tick' disabled).
This means it's not optional whether or not `CalcBar()` executes; it always does. Every script always calculates at least once per bar. It may not perform an action every time when `CalcBar()` executes, or your `CalcBar()` method may be empty with no code at all, but that doesn't mean that `CalcBar()` isn't called on every bar.
Edit. I noticed that your comment can also be read as 'it's good that the Boolean only executes the code once; that's what I need'. In that case my above explanation is not needed. But in that case I'm wondering why you say such a thing and not add it to the code?
Perhaps it's an idea to invest significantly more time in your replies, because it feels to me that I spend more time replying to you than you spend clarifying and proof-reading your requests for help. That's not how this is supposed to work in my view (assuming you want free help and a discussion that doesn't drag on for ages). Using the [ code ] .. [ / code ] tag would be nice too.
- - - - - - - -
By the way:
In your last script, you still have the values hardcoded. If you want to use your script on different charts, you'll probably want to use inputs so that you can configure the indicator for each chart. And not plot lines at 10,000 for EUR/USD, for instance, as the current script does.