- Clearpicks
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
How to change indicator value?
Collapse
X
-
How to change indicator value?
I use an indicator script to calculate some resistance and support lines every five minutes and draw them on the chart using DrawLine() and delete the old R/S lines at the same time. However if I click mouse on the chart to scroll the chart to the right, in most cases some line object would get selected and moved instead of the chart being scrolled, and I have to reload the indicators by pressing "F5". So I decide to use something like Add(new Line(MyColor, MyRSValue, "RSTag") to show the calculated R/S lines as horizontal lines. My question is how to change the MyRSValue in realtime to the calculated value? In those indicator script like pivot or rsi, the value is either set every tick/bar or set to a fixed value in intialize() function. What is the correct way to set my R/S lines? Your help is greatly appreciated.
- Clearpicks
Tags: None
-
Ray,
What if I want to use Add(Plot plot) instead of using Add(Line line)? The lines drawn by Add(Line line) extend to the right of the last bar, which make them interfere with the lines drawn by ChartTrader. Is there a simple way to move the line drawn by Add(Plot plot) to different R/S value in realtime trading similar to
Lines[0].Value = yourValue;
you just taught me?
- Clearpicks
Comment
-
Why couldn't you do something like this:
Code:protected override void Initialize() { Add(new Plot(Color.Magenta, PlotStyle.Line, "Sup")); // Plots[0] Add(new Plot(Color.Orange, PlotStyle.Line, "Res")); // Plots[1] Overlay = true; // Display over price panel. PriceTypeSupported = false; // Don't display price marker on right. } protected override void OnBarUpdate() { // // Calculate new support value and save it as NewSup // for (int idx=0; idx < CurrentBar; idx++) // Set all values of Sup plot. Plots[0].Set( idx, NewSup ); }
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by zstheorist, Today, 07:52 PM
|
0 responses
3 views
0 likes
|
Last Post
by zstheorist
Today, 07:52 PM
|
||
Started by pmachiraju, 11-01-2023, 04:46 AM
|
8 responses
149 views
0 likes
|
Last Post
by rehmans
Today, 06:44 PM
|
||
Started by mattbsea, Today, 05:44 PM
|
0 responses
5 views
0 likes
|
Last Post
by mattbsea
Today, 05:44 PM
|
||
Started by RideMe, 04-07-2024, 04:54 PM
|
6 responses
33 views
0 likes
|
Last Post
by RideMe
Today, 05:31 PM
|
||
Started by tkaboris, Today, 05:13 PM
|
0 responses
5 views
0 likes
|
Last Post
by tkaboris
Today, 05:13 PM
|
Comment