NinjaScript is beating me - futures io
futures io



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 3,200 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 11 posts
    2. attach_file 3 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

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

 
Search this Thread
 

NinjaScript is beating me

(login for full post details)
  #1 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received

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

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(82 thanks from 10 posts)
looks_twoSalao's Journalby Salao
(25 thanks from 6 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(25 thanks from 9 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(12 thanks from 7 posts)
looks_5Maybe a little bit different journalby Malykubo
(7 thanks from 3 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
futures io site changelog and issues/problem reporting
73 thanks
The Crude Dude Oil Trading System
73 thanks
Would You Sell Your System?
71 thanks
FIO Journal Challenge - April 2021 w/Jigsaw Trading
32 thanks
Big Mike in Ecuador
28 thanks
 
(login for full post details)
  #3 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received


 
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
 
(login for full post details)
  #4 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,968 since Jun 2009
Thanks: 32,434 given, 98,173 received

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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #5 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received

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
Register to download File Type: cs BigMikeHelp.cs (3.8 KB, 7 views)
Reply With Quote
 
(login for full post details)
  #6 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,968 since Jun 2009
Thanks: 32,434 given, 98,173 received

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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #7 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received

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:	69
Size:	324.2 KB
ID:	28434  
Reply With Quote
 
(login for full post details)
  #8 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 49,968 since Jun 2009
Thanks: 32,434 given, 98,173 received


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

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following user says Thank You to Big Mike for this post:
 
(login for full post details)
  #9 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
 
Posts: 798 since Jun 2009
Thanks: 109 given, 799 received

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

Reply With Quote
The following user says Thank You to MXASJ for this post:
 
(login for full post details)
  #10 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received


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:	55
Size:	129.2 KB
ID:	28435  
Reply With Quote
 
(login for full post details)
  #11 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received


Quoting 
Is the wrong syntax or needs to be in the Initialize() method.

It is in the Initialize() section of the code but is there another way of writing this that is the proper syntax or a character I am missing. I am extremely new to this, I have been piecing this whole project together taking lines out of indicators and strategies and trying to force them to work. Thank you for the help.

Reply With Quote
 
(login for full post details)
  #12 (permalink)
jtradr
Connecticut
 
 
Posts: 26 since Dec 2010
Thanks: 16 given, 27 received

Success!!

Thank you both very much. Big Mike you rock, I appreciate the help. I'm glad I joined up.

Good luck tomorrow.

Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > NinjaScript is beating me


Last Updated on January 13, 2011


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
 

Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only
     



Copyright © 2021 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