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
Difference of Two Indicators?
Collapse
X
-
Difference of Two Indicators?
HI, has anyone done an indicator to plot the difference of two indicators? What I've seen so far is spread stuff, that takes two instruments, but I want to take the running difference between two indicators, for instance RSI(14) and another indicator of 14 period or something like that. Thanks!Tags: None
-
Hello chinaexpert1a, thanks for your post.
That can be done like this:
Code:public class TestRSI : Indicator { private SMA _SMA0; private RSI _RSI0; protected override void OnStateChange() { if (State == State.SetDefaults) { //... } else if (State == State.Configure) { } else if(State == State.DataLoaded) { _SMA0 = SMA(14); _RSI0 = RSI(14, 3); } } protected override void OnBarUpdate() { var diff = _SMA0[0] - _RSI0[0]; Print(diff); } }
Chris L.NinjaTrader Customer Service
-
Great! Thank you... so I see you have provided me with code, hehe, I'm....? noooooob
Chris, do I need to make a custom indicator? I do want to, you suggest the 7+Breaking or other route, hire a programmer. :/
lol
Thanks
Andrew
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Adam Klaus, 03-26-2024, 07:43 PM
|
2 responses
21 views
0 likes
|
Last Post
by mcosta72
Today, 12:54 PM
|
||
Started by spottysallrite, Today, 11:31 AM
|
4 responses
9 views
0 likes
|
Last Post Today, 12:53 PM | ||
Started by cozypinto, 12-22-2023, 10:13 AM
|
4 responses
94 views
0 likes
|
Last Post
by Harvard
Today, 12:50 PM
|
||
Started by yaniv, Today, 12:50 PM
|
0 responses
0 views
0 likes
|
Last Post
by yaniv
Today, 12:50 PM
|
||
Started by Padan, Today, 02:02 AM
|
6 responses
18 views
0 likes
|
Last Post
by Padan
Today, 12:50 PM
|
Comment