thanks
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
indicator help
Collapse
X
-
Hello benrock,
To start you can create a new indicator with the original code from another indicator by going to the Control Center -> Tools -> Edit NinjaScript -> Indicators. Then double left click on the indicator that you want to have the original code from for example the "Stochastics". It will then open up the source code for the indicator. Right click inside the window and select Save As. Type in a name of your choosing then press "Save". Press the "OK" button. Now you have a new indicator based off the system indicator code that you can modify to set signals.
With your newly created indicator open you can add some custom code to set some signal conditions. For example:
For more information about the Stochastics indicator you may read the following link.Code:protected override void OnBarUpdate() { nom.Set(Close[0] - MIN(Low, PeriodK)[0]); (…) D.Set(SMA(K, PeriodD)[0]); //Declaring test variable for Stochastic K & D difference int stochasticDiff = 3; //Checks to see if the difference between K & D is equal to stochasticDiff if((K[0] – D[0]) == stochasticDiff || (K[0] – D[0]) == -stochasticDiff) { // Set Signal in here } }
Here is a link to our support forums that goes over how to debug your code which comes in handy if you run into a compiling errors when writing custom code.
Please let me know if I can be of further help.JCNinjaTrader Customer Service
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
43 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
25 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|
||
|
Started by CarlTrading, 03-31-2026, 09:41 PM
|
1 response
163 views
1 like
|
Last Post
|
||
|
Started by CarlTrading, 04-01-2026, 02:41 AM
|
0 responses
98 views
1 like
|
Last Post
by CarlTrading
04-01-2026, 02:41 AM
|
||
|
Started by CaptainJack, 03-31-2026, 11:44 PM
|
0 responses
158 views
2 likes
|
Last Post
by CaptainJack
03-31-2026, 11:44 PM
|

Comment