I've been able to adapt another indicator
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
DrawText Slope
Collapse
X
-
DrawText Slope
Hi,
I've been able to adapt another indicatorLast edited by stockgoblin; 03-25-2013, 05:16 PM.Tags: None
-
While this would not be very efficient and could put a strain on the system to check all the previous bars every new bar you could do so using a for loop.
C# iteration statements (for, foreach, do, and while) repeatedly execute a block of code. You use those statements to create loops or iterate through a collection.
Specifically a foreach loop if you need to check ALL previous bars: http://msdn.microsoft.com/en-us/libr.../ttw7t8t6.aspx
Additionally I don't know how much you've looked into calculating slopes but this may be of use: http://www.bigmiketrading.com/wiki/t...-in-indicatorsLanceNinjaTrader Customer Service
-
-
-
In this case you could just draw the object when it occurs. When you load the indicator onto the chart it would start at bar 0 and progress over the historical data drawing the objects along the way.
Using your example, something like
Code:if(Close[0]-Close[1] == Close[1]-Close[2]) //draw line
For a list of drawing object methods expand this link: http://www.ninjatrader.com/support/h...ml?drawing.htm
However if you needed to check more than just the previous two values you would need to create a loop.LanceNinjaTrader Customer Service
Comment
-
-
Those C# reference links will be a good place to start. Additionally I often find this website to be more educational for newer users: http://www.dotnetperls.com/for
Additionally we have recently begun offering premium education courses for learning NinjaScript: http://www.ninjatrader.com/PremiumEducation.php
Let me know if I can be of further assistance.LanceNinjaTrader Customer Service
Comment
-
Comment
-
Hello,
While you wouldn't have to it would probably be easier to use a DataSeries to store the slope values. You could then loop through that series using the for loop.
In terms of resources the time frame isn't going to be as important as the total number of bars loaded on the chart. The more bars, the more data it will have to loop over.LanceNinjaTrader Customer Service
Comment
-
Wow,
Thanks for that link. The SampleCustomDataSeries.zip indicator is exactly what I need to learn from and experiment with adapting them and building on them. Are there more of these Sample indicators in one place?
Comment
-
Yeah no problem. All of our samples and tips can be found on the main page of our forums.
Following are links to all available NinjaScript reference samples within this forum section: Strategy Reference Samples (NinjaTrader 8) - also applicable to NT7 Using a time filter to limit trading hours (http://www.ninjatrader.com/support/forum/showthread.php?t=3226) Using multiple entry/exit signals simultaneously
LanceNinjaTrader Customer Service
Comment
-
-
Your NinjaScript / C# Code will always be logically processed and evaluate according to your set logic – this can of course lead to unexpected results at times, thus we would suggest to simplify and debug your code to better understand the event sequence it would go through - unfortunately we cannot offer such debug or code modification services here, but please see the provided resources below to help you proceed productively :
First of all you would want to use Print() statements to verify values are what you expect. Its my assumption that the script my have an error if you were to open up the output window (tools -> output window) - Debugging your NinjaScript code.
For strategies add TraceOrders = true to your Initialize() method and you can then view valuable output related to strategy submitted orders through Tools > Output window - TraceOrders
It may also help to add drawing objects to your chart for signal and condition confirmation - Drawing Objects.
If you would prefer the debug assist of a professional NinjaScript consultant, please send mail to support [at] ninjatrader [com]
In the subject: ATTN Lance
In the body: please include this forum post link
LanceNinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by DJ888, Today, 10:57 PM
|
0 responses
2 views
0 likes
|
Last Post
by DJ888
Today, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Today, 10:23 PM | ||
Started by Belfortbucks, Today, 09:29 PM
|
0 responses
7 views
0 likes
|
Last Post
by Belfortbucks
Today, 09:29 PM
|
||
Started by zstheorist, Today, 07:52 PM
|
0 responses
7 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
151 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
Comment