NexusFi: Find Your Edge


Home Menu

 





NinjaScript is beating me


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one jtradr with 6 posts (0 thanks)
    2. looks_two Big Mike with 3 posts (1 thanks)
    3. looks_3 MXASJ with 2 posts (1 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 4,890 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 11 posts
    2. attach_file 3 attachments




 
Search this Thread

NinjaScript is beating me

  #1 (permalink)
jtradr
Connecticut
 
Posts: 26 since Dec 2010
Thanks Given: 16
Thanks Received: 27

Hi all,

I'm new here and have been working for the last few days on a strategy off a custom indicator. On Monday I had zero experience programming and now I think I actually have less somehow. I was just about to shoot myself till I thought I would ask here for some help.

I have a strategy based off the strategy walkthrough that Mike put up and when I used the code it is absolutely fraught with errors. I won't cut and paste the entire thing in here but if someone is looking at this and sees a problem please help me out.

[Description("")]
[GridCategory("Parameters")]
public bool BE2
{
get { return be2; }
set { be2 = value; }
}
#endregion
}
}


This piece of code returns three { or ; expected errors alone.

Additionally there are 128 lines of code in the strategy and in the error box there are errors preventing me from compiling on lines 133 through 150. I would fix them if only they existed.

Thanks in advance

if (Code = Fixed) return;
else kill self;

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #3 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800


 
Code
if (Code = Fixed) return;
else kill self;
Watch that if statement. The single '=' assigns value 'Fixed' to variable 'Code'. To compare them for equilty you need to use '=='.

Also, the name of the 'kill self' method needs to be contiguous ie 'kill_self' or 'killSelf', and if there are no overrides it would be 'killSelf()'.

I prefer the AskForHelp() or HaveABeerAndThinkAboutIt() methods personally...

Reply With Quote
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,662

Without posting the file, no one can help you. Your snippet is not enough. You also need to specify what version of NT you are using.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
jtradr
Connecticut
 
Posts: 26 since Dec 2010
Thanks Given: 16
Thanks Received: 27

Sorry about that but I appreciate any help. I'll attach the file to this post.

Thank you in advance.

I'm using NT7

Attached Files
Elite Membership required to download: BigMikeHelp.cs
Reply With Quote
  #6 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,662

The code looks fine.

The problem is somewhere else most likely. I don't use NT anymore, so am only eyeballing it.

Post a screen shot of the compilation errors (the bottom of the page with all the error messages). Make sure you expand (widen) the columns so we can see everything. It should be telling you the filename of the problem script.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
jtradr
Connecticut
 
Posts: 26 since Dec 2010
Thanks Given: 16
Thanks Received: 27

Hmmm now that you bring it up the errors seems to be in a file I am not using. Here is the screen

Attached Thumbnails
Click image for larger version

Name:	BigMikeHelpScreen.jpg
Views:	129
Size:	324.2 KB
ID:	28434  
Reply With Quote
  #8 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,662


jtradr View Post
Hmmm now that you bring it up the errors seems to be in a file I am not using. Here is the screen

I've done this a few times

Start by deleting the strategy "MyMoneyMakerLearn". You may have to delete it using Windows Explorer from your Documents/NinjaTrader/bin/custom/strategy directory.

Then recompile. If there is still an error, you need to widen the "Error" column, because we can't see the full error message on the top error (duplicate namespace).

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

 
Code
EntryHandling = EntryHandling.UniqueEntires;
Is the wrong syntax or needs to be in the Initialize() method.

Reply With Quote
Thanked by:
  #10 (permalink)
jtradr
Connecticut
 
Posts: 26 since Dec 2010
Thanks Given: 16
Thanks Received: 27


That helped immensely but now there are two and one is so long I can't fit the thing in the window, hopefully you can get the jist.

And just in case the first error is in BigMikeHelp.cs the file I just made for you
and the second is mycustomstrategy.cs also not in use.

Attached Thumbnails
Click image for larger version

Name:	BigMikeHelpScreen2.jpg
Views:	110
Size:	129.2 KB
ID:	28435  
Reply With Quote




Last Updated on January 13, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts