Compiling Error (Statement Expected) - NinjaTrader Programming | futures io social day trading
futures io futures trading


Compiling Error (Statement Expected)
Updated: Views / Replies:2,839 / 32
Created: by sagetrade Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 3  
 
Thread Tools Search this Thread
 

Compiling Error (Statement Expected)

  #1 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 47 since Jul 2013
Thanks: 28 given, 10 received

Compiling Error (Statement Expected)

Hi Guys,
I get a compiling error at the end of row 4. "Statement expected".
Any idea how I can resolve?


Quoting 
void TradeSize()
{
if (Close - anaSuperTrendM11(1, 10, 5, false).StopDot[0]) != 0;
vTradeSize = RiskSize / Math.Abs(Close - anaSuperTrendM11(1, 10, 5, false).StopDot[0]);
else vTradeSize = 0;

vTradeSize = Math.Floor(vTradeSize);
TradeSize = vTradeSize;
}


Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Cedar Rapids, iowa
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Ninjatrader - Continuum
Favorite Futures: 6E, TF, 6J
 
Tasker_182's Avatar
 
Posts: 626 since Aug 2009
Thanks: 426 given, 1,126 received



sagetrade View Post
Hi Guys,
I get a compiling error at the end of row 4. "Statement expected".
Any idea how I can resolve?

This if/else statement is confused, try this:

void TradeSize()
{
if
{
(Close - anaSuperTrendM11(1, 10, 5, false).StopDot[0]) != 0;
vTradeSize = RiskSize / Math.Abs(Close - anaSuperTrendM11(1, 10, 5, false).StopDot[0]);
}
else vTradeSize = 0;

vTradeSize = Math.Floor(vTradeSize);
TradeSize = vTradeSize;
}

"Money is better than poverty, if only for financial reasons." - Woody Allen
Reply With Quote
 
  #4 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,572 given, 3,982 received

Nope.
Try:
 
Code
                            
void TradeSize()

  if { (
Close anaSuperTrendM11(1105false).StopDot[0]) != ) {
    
vTradeSize RiskSize Math.Abs(Close anaSuperTrendM11(1105false).StopDot[0]); 
  }
  else 
    
vTradeSize 0;
... 
In fact your line
 
Code
                            
if (Close anaSuperTrendM11(1105false).StopDot[0]) != 0
doesn't make sense: you test a condition, but do not do anything with it.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 47 since Jul 2013
Thanks: 28 given, 10 received

Okay. I tried to translate a Function from Easy Language, which is...


Quoting 
//the Close - vSuperTrend <> 0 check avoids division by zero errors
if Close - vSuperTrend <> 0 then
vTradeSize = RiskSize / AbsValue(Close - vSuperTrend)
else vTradeSize = 0;

//round to the next lowest value
vTradeSize = Floor(vTradeSize);

... 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?

Reply With Quote
 
  #6 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,572 given, 3,982 received


sagetrade View Post
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?

You had no THEN, just an IF, and then, nothing...
It's basically, in C#:
 
Code
                            
if (my condition
  
action
or easier to read (IMHO)
 
Code
                            
if (my condition) {

  
action;


Success requires no deodorant! (Sun Tzu)
Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 47 since Jul 2013
Thanks: 28 given, 10 received

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?

Reply With Quote
 
  #8 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,366 since Jun 2009
Thanks: 3,572 given, 3,982 received

In EL your condition is

Quoting 
Close - vSuperTrend <> 0

and your action is

Quoting 
vTradeSize = RiskSize / AbsValue(Close - vSuperTrend)

Affecting a value to a variable is an action (well, this is what I meant...).

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #9 (permalink)
Trading Apprentice
Frankfurt / Germany
 
Futures Experience: Intermediate
Platform: NT, MC
Favorite Futures: Stocks, Futures
 
sagetrade's Avatar
 
Posts: 47 since Jul 2013
Thanks: 28 given, 10 received

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

Plz See attached pic:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
 
  #10 (permalink)
Elite Member
San Diego
 
Futures Experience: Intermediate
Platform: NinjaTrader/Think or Swim
Broker/Data: TDA/Interactive Brokers/ Data Feed TDA & IBK ( Dropped Kinetick)
Favorite Futures: Stocks NASDAQ
 
bd92154's Avatar
 
Posts: 990 since May 2011
Thanks: 1,536 given, 431 received



sagetrade View Post
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

Plz See attached pic:
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

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.

Hope this helps some.

Reply With Quote
The following user says Thank You to bd92154 for this post:

Reply



futures io > > > > > Compiling Error (Statement Expected)

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trade Size Analyzer compiling error sudhirc The Elite Circle 1 March 16th, 2012 01:26 PM
Error compiling indicators rltheg NinjaTrader Programming 13 March 29th, 2011 05:10 PM
NT7 audio alert - statement expected? subterfuge NinjaTrader Programming 2 March 17th, 2011 10:55 AM
NT indicator script compiling issuses / error while importing skyfly NinjaTrader Programming 8 July 20th, 2010 01:56 AM
C# Math.net and compiling tinkerz NinjaTrader Programming 1 April 6th, 2010 06:33 PM


All times are GMT -4. The time now is 04:14 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2017-12-12 in 0.12 seconds with 20 queries on phoenix via your IP 54.163.210.170