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)
After trying to pay three different freelance coders and purchasing a course on ninjascript, I still am at a loss. (The coders failed to provide code, and the course was for intermediate coders and did not explain even the basics)
I'm a full time discretionary trader, and have been in the markets for over a decade.
There was a period of time several years ago where I wrote and tested hundreds of EAs in MT4 using MQL4 so I felt that would be a reasonable prereq for coding ninjascript, but the resources for ninjascript are not beginner friendly like they are for MQL4.
Originally my project was to have an automated exit strategy for manually placed orders (placed in chart trader using hot keys). ES only, one trade at a time, intraday only.
I've received the advice on this forum to make an indicator that plots a line, then use the ATM strategy "thing/tool" (not sure what the terminology is as I'm new to ninja).
Does anyone have just a simple line or two of code they can share with me to plot a line? I tried using the wizard to create an indicator, and tried to use:
But when I got the calculation for "Y" I started running into errors, which resulted in an error: "ninjascript must be in a compilable state to create or edit strategies"
I've been at this for nearly 8 hours and could really use a helping hand.
My goal is so simple, I just want a horizontal line to be plotted when these conditions are met:
- drop down menu to select variable: long/short
- variable the user can change: bodysize_minimum (ticks)
- variable the user change: stop_buffer (ticks)
for longs:
if close[1]>open[1] && close[1]-open[1] >= bodysize_minimum
then move the line (to be used as a trailing stop) to this location: low[1]-stop_buffer
The idea is to exit when a "strong" bar that closes in the direction of the current trade is broken.
The opposite would be true for shorts.
Does anyone have the time or inclination to share with me a very basic few lines of code?
I've never gotten any code in ninja to work, so if you could find it in your heart to explain how to use the code I'd be so grateful.
I feel like such an idiot to have to post this. Not only have I written and tested hundreds of EAs for MT4, but I've done so using they very easy easylanguage in tradestation, which was wonderful.
I'm considering just writing code and trading in tradestation, but I use the orderflow tools in ninja to make a living, and would love to start making progress in this platform, but it there is so much less learning material for NT.
Can you help answer these questions from other members on NexusFi?
Learning Note... whenever you see something like "NinjaTrader.Custom.Resource.CCILevel2" in a OCS().SetDefaults that also means "replace this 'resource' with any text name you want in quotes..
E.g. swap "... , NinjaTrader.Custom.Resource.CCILevel2);"
for
" ... , "Finally my own darn line.");
Possible a more helpful answer is to check out this syntax.
"AddLine(new Stroke(Brushes.Yellow, DashStyleHelper.Solid, 2), PlotStyle.Line, "Yes!, Test & DataBox Title of a My own Powerful Line Construct");
------------------------
Another line ....
Keyword here is TickSize. Tip: Use X times TickSize to handle any candle body size your after.
Assuming 'bodysize Min is 3X the Tick Size of the instrument ...
this compiles for me: if(Close[1] > Open[1] && ( Close[1] - Open[1] ) >= (TickSize * 3));
and.. if(Close[1] > Open[1] && ( Close[1] - Open[1] ) >= (TickSize * BodySize)); // "BodySize" being the public Property you configured for user input when attaching the indicator to the chart.
Super easy. Open any / all Indicator and Strategy "Samples" provided in the default NT8 install and look at the #region near the bottom titled "Properties"
Bonus Answer:
The NT Support staff is unusually good / strong at helping people who are trying..
This approach typically gest a pretty good response..
1) A post here with I am trying to build this in the Builder.
2) Here is the *.cs code of what I have accomplished so far. ing and struggling
3) This is the specific next step I need help with.
Bonus Answer #2:
As 'chewy' as the builder can be using it to prototype will produce time saving code that shows exactly how NT8 expects you to code things.
... although if you have developed hundreds of EAs than maybe skip the Builder and look at provided "Samples' code references I provide in the links below.
Bonus Answer #3
Studying these examples is a great way to learn how to code so that Ninja likes your code and is a good source of ideas.
I can empathize with your difficulties. I think that to get this to work, you will need more than "a very basic few lines of code" -- not because this is going to be a hard thing for someone to do, but because you would first need to understand the structure of an NT indicator script, and basically how to write NT code in the first place. Since you have not had much success with NT scripts, I think that is where you would need to go first -- but this could get to be a big job, just to get a fairly simple script done.
I also think there is an easier way.
I suggest you make a post in the following thread, with a clear and simple explanation of what you are looking for. (The list of conditions you gave, plus an explanation of what it is supposed to do and how you will use it should do nicely.) Someone may be willing to just write the indicator for you based on your specification and your description of what you want it to do. Here's the thread:
Hey guys, I thought many of you would enjoy and benefit from this thread. My intention is to have each poster reply and describe in as much detail as possible an indicator they want created for NinjaTrader.
The programmers on the forum (there are many), …
It's been years since I did any NT coding and I'm no longer up on it, but there are many coders who watch that thread and who may be willing to help.
Since you ask about an indicator, I am suggesting the free indicator thread. If you want the code to automatically manage your entries or exits, then that would be, in NT-lingo, a "strategy," which is another breed of cat. But there would be some similarity in the code. There is also a free NT strategy thread, somewhat less used, because the tasks the code has to do are more involved. You can check this link as well:
I get a lot of requests for help building strategies. Many of which are repeats of other requests. I am starting this thread to handle many of these requests as the public building and revising of strategies would certainly help the community. Please …
If the indicator would satisfy what you need, you might want to try that first.
Just remember that clarity and simplicity is the way to get people to understand what you need and to get them to help. Let people know how you want to use it and see if it sparks some interest. Good trading ideas often do.
Good luck. I hope you get what you need.
Bob.
When one door closes, another opens.
-- Cervantes, Don Quixote