Thanks.
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
Adding up/down arrows to Sto chart.
Collapse
X
-
Adding up/down arrows to Sto chart.
I have stochastics as panel 2 on my charts. I would like to have a down arrow drawn on the sto chart when it crosses below 80 and an up arrow drawn when crosses above 20. this seams simple enough and may have been discussed before but I can't seem to get it to work.
Thanks.Tags: None
-
Hello TraderThor, and thank you for your question. All the below code will go into your OnBarUpdate routine. I will assume the following settings :
Code:[FONT=Courier New]int DPeriod = 3; int KPeriod = 14; int smoothing = 7; int lookbackPeriod = 3; int upperBound = 80; int lowerBound = 20;[/FONT] [FONT=Courier New]bool autoScale = false; Color upArrowColor = Color.Green; Color downArrowColor = Color.Red; [/FONT]
First, we need to see if the Stochastics indicator crossed our barriers. That code is
Code:[FONT=Courier New]// Stochastics indicator documented here // http://ninjatrader.com/support/helpGuides/nt7/stochastics.htm[/FONT] [FONT=Courier New]// http://ninjatrader.com/support/helpGuides/nt7/crossbelow.htm[/FONT] [FONT=Courier New]if (CrossBelow(Stochastics(DPeriod, KPeriod, smoothing).K, upperBound, lookbackPeriod)) { // Draw our down arrow } // http://ninjatrader.com/support/helpGuides/nt7/crossabove.htm if (CrossAbove(Stochastics(DPeriod, KPeriod, smoothing).K, lowerBound, lookbackPeriod)) { // Draw our up arrow } [/FONT]
Code:[FONT=Courier New]// http://ninjatrader.com/support/helpGuides/nt7/drawarrowup.htm DrawArrowUp("UpArrow" + CurrentBar, autoscale, 0, lowerBound, upArrowColor); [/FONT]
Code:[FONT=Courier New]// http://ninjatrader.com/support/helpGuides/nt7/drawarrowdown.htm DrawArrowDown("DownArrow" + CurrentBar, autoscale, 0, upperBound, downArrowColor); [/FONT]
Please let us know if there are any other ways we may help.Jessica P.NinjaTrader Customer Service
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kaywai, 09-01-2023, 08:44 PM
|
5 responses
601 views
0 likes
|
Last Post Today, 12:32 AM | ||
Started by xiinteractive, 04-09-2024, 08:08 AM
|
6 responses
22 views
0 likes
|
Last Post Today, 12:31 AM | ||
Started by Pattontje, Yesterday, 02:10 PM
|
2 responses
18 views
0 likes
|
Last Post
by Pattontje
Yesterday, 11:49 PM
|
||
Started by flybuzz, 04-21-2024, 04:07 PM
|
17 responses
230 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:45 PM
|
||
Started by agclub, 04-21-2024, 08:57 PM
|
3 responses
17 views
0 likes
|
Last Post
by TradingLoss
Yesterday, 11:42 PM
|
Comment