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)
Programming my first strategy - need a little review
I am coding my first strategy from scratch, using a boolseries.
Entry is very simple: on the change in trend from the HeikinAshiPaintBars indicator.
Exit is 5 ticks beyond the extreme of the bar in which the indicator reverses itself again.
I still need to add a stoploss when a new position is opened; I will use onorderupdate() for that.
But I need help with the #region Properties
I have getting the error namespace member declaration expected on the last line, and so it won't compile. I can't figure out what I am supposed to add here. Any help would be appreciated.
Can you help answer these questions from other members on NexusFi?
You are mixing parentheses ( ) with curly brackets { } so the compiler is confused when certain code blocks begin and end. Code blocks begin and end with brackets, not parentheses. The Condition Set 3 and Condition Set 4 blocks are using parentheses when they should use brackets. Also I noticed there is a closing parentheses at the bottom where you have all of those brackets stacked up.
You should vertically align your begin and ending brackets to make sure they are matching up properly, not pile them all together like you did at the end of the file.
Programming requires exact attention to details like these.
The anaHeikinAshi indicator comes with an internal BoolSeries "upTrend". The indicator further comes with a public property "UpTrend" that can be used to access the BoolSeries via a strategy.
To access the indicator
(1) add an instance …
)
You also appear to have deleted the NinjaScript generated code for handling the input parameters, I have tidied the code and commented out the missing requirements until you download and install them in your system. I don't have them in my system so check with @Fat Tails if you don't already have them. (I tried a couple of forum searches but nothing showed up, but then it often does that to me.)
Clicking on brackets or parentheses will highlight the matching one in the editor, and clicking on the left hand side [+]/[-] boxes to see sections in/out also helps. When it doubt, comment it out and add bits back in slowly, and sometimes do it into a complete newly generated file in case of really hard to spot junk characters or oddball stuff that's crept in.
Formatting better will help a lot, but cut/paste from Ninja into these CODE blocks in posts can give messy results due to lack of TAB handling on editing and different mixes of tabs/spaces, etc so just edit as per your prefs, where possible use tabs consistently before adding spaces to align, i.e. whatyouseemightnotbewhatyouget (as you can see here.) Using a ZIP file is preferable for large projects, but this way can be ok for fast glances.
It compiles fine now but I doubt that it is either correct or will make you a fortune if it is, have fun.
Your comment was spot on. The text was so small on my screen, the parentheses and curly brackets looked the same. I bumped up the font size, and problem solved! Thank you so much, I had been spinning my wheels for hours.