Announcement
Collapse
No announcement yet.
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.
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
<span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>
Comment
-
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Today, 05:17 AM
|
0 responses
51 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
127 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
69 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
42 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
46 views
0 likes
|
Last Post
|

Comment