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)
Be yourself; everyone else is already taken. Oscar Wilde
sam028
Site Moderator
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
Nope.
Try:
In fact your line
doesn't make sense: you test a condition, but do not do anything with it.
Success requires no deodorant! (Sun Tzu)
sagetrade
Frankfurt / Germany
Posts: 47 since Jul 2013
Thanks Given: 28
Thanks Received: 11
Okay. I tried to translate a Function from Easy Language, which is...
... it is supposed to determine the Position Size.
Essentially, Im checking if Supertrend is unequal to zero, to determine the difference between ST's value and the current Close of the bar - then calculating the position size in relation to an input "RiskSize" and round it the next lowest value.
Would be great if you could tell me what the problem is with this if statement and how I can solve this?
sam028
Site Moderator
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
You had no THEN, just an IF, and then, nothing...
It's basically, in C#:
or easier to read (IMHO)
Success requires no deodorant! (Sun Tzu)
sagetrade
Frankfurt / Germany
Posts: 47 since Jul 2013
Thanks Given: 28
Thanks Received: 11
But there is no "action" I can code, because what I want to achieve is just a definition.
The action in EL was just "begin". Whats the "begin" synonym in C# ? How does my code have to look like?
sam028
Site Moderator
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629
In EL your condition is
and your action is
Affecting a value to a variable is an action (well, this is what I meant...).
Okay, I got that. But how does the code have to look like? How do I connect condition & action here?
If I take your code from #3, I get plenty of errors
Best wishes at solving your coding issue.
What has worked for the little amount of coding that I have done is to tackle the errors one at a time and then recompile. Your if statement has some syntax issues that the compiler is pointing out. The curly brackets should be after your initial if statement for exactly action you want done. Here is link to online NT7 guide which may help some. NinjaTrader Version 7.
Also here is a sample if from that same guide.
---------------------------------from online guide------------------------------------
// The following code encloses two statements with curly braces
if (x == 5)
{
Print("NinjaTrader");
Print("NinjaScript");
}
You can enclose several comment lines using the "/*" characters to start the comment block and then using the "*/" characters to end the comment block.
--------------------------------------------------------------------------------------------
Still very new to C# and NT7 coding here so as far as the rest of your program I don't know. Many times clearing up initial errors will clear errors that are later on in your code though, that is why you need to start at error one.