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


Compiling Error (Statement Expected)
Updated: Views / Replies:2,832 / 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)

  #21 (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


dynoweb View Post
Really you should have deleted lines 71-74 since they are after the return statement.

vTradeSize is a variable with a scope inside the TradeSize method. It's initialized to 0 so if that if condition doesn't run this method will return 0. If the if condition is true, the it will return the vtradeSize value of non-zero.

You can also print the values to be sure your calculations are as you expect, look in the console window for the output.

Print("Returning " + (int) Math.Floor(vTradeSize);
Return (int) Math.Floor(vTradeSize);


Rick

I did that. Code now looks as follows:


Quoting 
// Position Size
int TradeSize()
{
double vTradeSize = 0;
if ((Close[0] - anaSuperTrendM11(ATRMedian, ATRMult, ATRPeriod, false).StopDot[0]) != 0)
{
vTradeSize = RiskSize / Math.Abs(Close[0] - anaSuperTrendM11(ATRMedian, ATRMult, ATRPeriod, false).StopDot[0]);
}
return (int) Math.Floor(vTradeSize);
}

It should work now :/
You have any further remarks?
@dynoweb
where in the code do i have to insert the print code of yours, that it shows me the calcs? In my output window, it doesn't show anything.


Last edited by sagetrade; August 14th, 2013 at 02:28 PM.
Reply With Quote
 
  #22 (permalink)
Elite Member
McKinney, TX
 
Futures Experience: Intermediate
Platform: Think or Swim, NinjaTrade
Favorite Futures: The indexes, ES, YM, NQ & RTY
 
Posts: 152 since Aug 2012
Thanks: 213 given, 125 received


sagetrade View Post
I did that. Code now looks as follows:



It should work now :/
You have any further remarks?
@dynoweb
where in the code do i have to insert the print code of yours, that it shows me the calcs? In my output window, it doesn't show anything.

Put it just before the return so you get the same value on the console window as you are returning.

Reply With Quote
The following user says Thank You to dynoweb for this post:
 
  #23 (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


OK, I found the problem.

It is within the Order Generation Code:


Quoting 
protected override void OnBarUpdate()
{
// Condition set 1
if (anaSuperTrendM11(1, 10, 5, false).StopDot[1] > Close[1]
&& anaSuperTrendM11(1, 10, 5, false).StopDot[0] < Close[0])
{
EnterLong(TradeSize(), "Buy Long");
}

// Condition set 2
if (Position.Quantity > 0
&& anaSuperTrendM11(1, 10, 5, false).StopDot[1] < Close[1]
&& anaSuperTrendM11(1, 10, 5, false).StopDot[0] > Close[0])
{
ExitLong("Exit Long", "");
}

This code gives a very high TradeSize however if I change the code to..


Quoting 
protected override void OnBarUpdate()
{
// Condition set 1
if (anaSuperTrendM11(1, 10, 5, false).StopDot[2] > Close[2]
&& anaSuperTrendM11(1, 10, 5, false).StopDot[1] < Close[1])
{
EnterLong(TradeSize(), "Buy Long");
}

// Condition set 2
if (Position.Quantity > 0
&& anaSuperTrendM11(1, 10, 5, false).StopDot[1] < Close[1]
&& anaSuperTrendM11(1, 10, 5, false).StopDot[0] > Close[0])
{
ExitLong("Exit Long", "");
}
}

..it works fine.

I don't really care, because the order generating is just random, Im not going to use those Supertrend crossovers.
However, I'm still interested why the first code generates a huge order size and the second generates as expected. Seems as with the first code the supertrend-values are just too close to price-action. Any ideas on this? There must probably be a more efficient way to code Supertrend crossovers.


Last edited by sagetrade; August 14th, 2013 at 03:48 PM.
Reply With Quote
 
  #24 (permalink)
Elite Member
McKinney, TX
 
Futures Experience: Intermediate
Platform: Think or Swim, NinjaTrade
Favorite Futures: The indexes, ES, YM, NQ & RTY
 
Posts: 152 since Aug 2012
Thanks: 213 given, 125 received

You might want to check if you are already in a trade before entering another trade.

if (Position.MarketPosition == MarketPosition.Flat)
{
if (goodEntryCondition)
{
place trade order
}
}


The way you have it in your code right now is every time the bar updates and your condition is true you are hitting EnterLong(..)

You can also do a check before your long exit

if (Position.MarketPosition == MarketPosition.Long)
{
ExitLong("Exit Long", "Buy Long"); // note the second arg is the signal name of your trade when you went long
}

Reply With Quote
The following user says Thank You to dynoweb for this post:
 
  #25 (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


dynoweb View Post
You might want to check if you are already in a trade before entering another trade.

if (Position.MarketPosition == MarketPosition.Flat)
{
if (goodEntryCondition)
{
place trade order
}
}


The way you have it in your code right now is every time the bar updates and your condition is true you are hitting EnterLong(..)

You can also do a check before your long exit

if (Position.MarketPosition == MarketPosition.Long)
{
ExitLong("Exit Long", "Buy Long"); // note the second arg is the signal name of your trade when you went long
}

thx for the remark. It worked fine however, as I had only 1 Trade per Direction and also before a new entry condition can appear it will always be a position close first. Thx nevertheless.

Do you have any ideas on how to improve the entry condition? In terms of code I mean?

Is there another/better way to code a switch of trend in supertrend?

Btw what does this ".StopDot" stand for?

Reply With Quote
 
  #26 (permalink)
Elite Member
McKinney, TX
 
Futures Experience: Intermediate
Platform: Think or Swim, NinjaTrade
Favorite Futures: The indexes, ES, YM, NQ & RTY
 
Posts: 152 since Aug 2012
Thanks: 213 given, 125 received


sagetrade View Post
thx for the remark. It worked fine however, as I had only 1 Trade per Direction and also before a new entry condition can appear it will always be a position close first. Thx nevertheless.

Do you have any ideas on how to improve the entry condition? In terms of code I mean?

Is there another/better way to code a switch of trend in supertrend?

Btw what does this ".StopDot" stand for?

I'm not sure if you have access to the elite forums, but there are a lot of very experienced traders tracking their trades on a journal. Take a look at that if you have a chance.

I don't use the ana super trend indicators so I really can't say without digging into the code. But I've been working with the Stochastics indicator and using that to trigger my entries. It really can't be used by itself for auto trading since you need to know that you are in a trend and it's the first or second pull back on a trend for a trend continuation trade.

Also take a look at the Battle of the Bogs thread and inspect the code on those bots to see what they are doing.

Reply With Quote
 
  #27 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,215 received


dynoweb View Post
I'm not sure if you have access to the elite forums

If the username in profile on left of each post is not highlighted (yellow, red) then the member is not an Elite Member.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #28 (permalink)
Elite Member
McKinney, TX
 
Futures Experience: Intermediate
Platform: Think or Swim, NinjaTrade
Favorite Futures: The indexes, ES, YM, NQ & RTY
 
Posts: 152 since Aug 2012
Thanks: 213 given, 125 received


Big Mike View Post
If the username in profile on left of each post is not highlighted (yellow, red) then the member is not an Elite Member.

Mike

Hey Mike, I noticed you weren't an Elite Member, your not yellow or red

All joking aside, @sagetrade if you're serious at all about learning to trade you really need to bite the bullet and change your membership to Elite, you won't get a better value for that small amount of investment. That's your first winning trade.

Reply With Quote
 
  #29 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,238 since Jun 2009
Thanks: 29,350 given, 83,215 received

Lol well two people in 50,000 are purple but yes should have included that...

Sent from my LG Optimus G Pro

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
 
  #30 (permalink)
Market Wizard
Columbus, OH
 
Futures Experience: None
Platform: NT 8, TOS
Favorite Futures: ES
 
Silvester17's Avatar
 
Posts: 3,332 since Aug 2009
Thanks: 4,579 given, 10,313 received



Big Mike View Post
If the username in profile on left of each post is not highlighted (yellow, red) then the member is not an Elite Member.

Mike

something changed?

market wizards (red) didn't have to be elite members.

Reply With Quote

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 01:30 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-11 in 0.15 seconds with 20 queries on phoenix via your IP 54.145.16.43