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
Looking for basic script to add arrows and signals to graph
Collapse
X
-
Looking for basic script to add arrows and signals to graph
I am looking to identify candle stick patterns when certain conditions are met, but i can't seem to figure out the logic needed to apply these to my graph. Would i need to use onbarupdate method?Tags: None
-
-
Hello hdshev,
Thank you for your post.
The built in Candle Stick Pattern indicator may be of use to you:
If you're defining your own conditions to identify a candlestick pattern and want to draw something on the chart when this occurs, you could use a drawing tool like cincai suggested. Calling the tool within OnBarUpdate would be recommended. To ensure you're drawing the tool on each bar for which the conditions are met you'd want to use a unique tag name for each. For example:
protected override void OnBarUpdate()
{
if(your conditions for entry)
{
Draw.Text(this, "myText" + CurrentBar, "My Pattern found", 0, High[0] + (2 * TickSize));
}
}
This would print "My Pattern found" 2 ticks above the high of the bar the conditions were true for. You could do something similar if you instead wanted to draw an arrow above the bar.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
-
Based on certain criteria, I have added the following code:
Draw.ArrowDown(this, "tag1", true, 0, High[0] + 1, Brushes.Red);
The arrow appears for the latest condition but removes prior arrows. How do I get all the arrows for the conditions to stay on the chart without removing them?
I want the arrows under or on top of the bar to stay on for all conditions met historically.
Thanks.Last edited by givemefood; 03-18-2024, 01:54 PM.
Comment
-
Hello givemefood,
Thanks for your notes.
To have arrows remain drawn on the chart historically you would need to use a unique tag name in your Draw.ArrowDown() method. See the notes below from the Draw.ArrowDown() help guide documentation.
"tag: A user defined unique id used to reference the draw object.
For example, if you pass in a value of "myTag", each time this tag is used, the same draw object is modified. If unique tags are used each time, a new draw object will be created each time."
This is typically done by using CurrentBar for the tag parameter in the Draw.ArrowDown() method since the CurrentBar value will be different on each bar.
For example, the code might look something like this:
Draw.ArrowDown(this, "tag1" + CurrentBar, true, 0, High[0] + 1, Brushes.Red);
CurrentBar: https://ninjatrader.com/support/help...currentbar.htm
Brandon H.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by habeebft, Today, 07:27 AM
|
1 response
10 views
0 likes
|
Last Post Today, 08:08 AM | ||
Hi
by AveryFlynn
Started by AveryFlynn, Today, 04:57 AM
|
1 response
11 views
0 likes
|
Last Post Today, 07:57 AM | ||
Started by Max238, Today, 01:28 AM
|
4 responses
37 views
0 likes
|
Last Post
by Max238
Today, 07:49 AM
|
||
Started by r68cervera, Today, 05:29 AM
|
1 response
9 views
0 likes
|
Last Post Today, 07:47 AM | ||
Started by geddyisodin, Today, 05:20 AM
|
1 response
11 views
0 likes
|
Last Post Today, 07:38 AM |
Comment