NexusFi: Find Your Edge


Home Menu

 





how do i change RSI 50 line to Zero


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ceramictilepro with 13 posts (1 thanks)
    2. looks_two Fat Tails with 8 posts (3 thanks)
    3. looks_3 TimC with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 9,236 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 24 posts
    2. attach_file 7 attachments




 
Search this Thread

how do i change RSI 50 line to Zero

  #11 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21


Fat Tails View Post
Just try different moving averages, start with EMA and SMA, it is nothing special.

if you ever have any tile or grout related q's, let me know and i would be happy to help you out!

thanks again. i would've never been able to figure out the change in code!

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #12 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21


Fat Tails View Post
Just try different moving averages, start with EMA and SMA, it is nothing special.


ok, i hacked in some code (6.5 VERSION) and was surprised that ninja didn't blow up on me

i was trying to have the color change when above the 10 line.

then change to a different color when below the -10 line.

the third color would be everything else.

any ideas?
thx!

Attached Files
Elite Membership required to download: rsi_colorchange.zip
Started this thread Reply With Quote
  #13 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103



ceramictilepro View Post
ok, i hacked in some code and was surprised that ninja didn't blow up on me

i was trying to have the color change when above the 10 line.

then change to a different color when below the -10 line.

the third color would be everything else.

any ideas?
thx!

You have now defined 5 plots. So the original plot will plot alongside with the new plots.

NinjaTrader 7 offers a more elegant way to color a PlotSeries. Just have one plot defined and then adapt the color, for example the code

 
Code
 
if (RSI(period, smooth)[0] < -10)
PlotColors[1][0] = Color.Red
will color the current value of the plot number 1 red. This is recommended as it also colors the line between the current value at [0] and the prior value at [1].

Reply With Quote
  #14 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21


Fat Tails View Post
You have now defined 5 plots. So the original plot will plot alongside with the new plots.

NinjaTrader 7 offers a more elegant way to color a PlotSeries. Just have one plot defined and then adapt the color, for example the code

 
Code
 
if (RSI(period, smooth)[0] < -10)
PlotColors[1][0] = Color.Red
will color the current value of the plot number 1 red. This is recommended as it also colors the line between the current value at [0] and the prior value at [1].

ok thx Fat Tails.

the indicator i hacked up was for 6.5 (should've mentioned that in the prior post and will edit it to show) so it sounds like it will take more work to make it work for 6.5.


i will use your idea for 7.

Started this thread Reply With Quote
Thanked by:
  #15 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21

ok, so here is some code that i know won't work but hopefully it will explain what i'm looking for: this is for 6.5 but if N7 is better for this, i wouldn't complain

basically looking for a "cross back below the 10 line" and "cross back above the -10 line"


also, can anyone tell me if using the "CurrentBar.ToString" uses alot of CPU which may bog the chart down?

thx!

 
Code
double rsi   = avgDown[0] == 0 ? 100 : 100 - 100 / (1 + avgUp[0] / avgDown[0]);
   rsi = rsi - 50;
   double rsiAvg = (2.0 / (1 + Smooth)) * rsi + (1 - (2.0 / (1 + Smooth))) * Avg[1];
   Avg.Set(rsiAvg);
   Value.Set(rsi);
 
if (rsi[1] > 10 && rsi[0] < 9.95)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, High[0] + 4 * TickSize, Color.Red);
   }
 
 
if (rsi[1] < -10 && rsi[0] > -9.95)
   {
    DrawDot(CurrentBar.ToString() + "low", 0, Low[0]  -4 * TickSize, Color.Blue);
   }

Started this thread Reply With Quote
  #16 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


ceramictilepro View Post
ok, so here is some code that i know won't work but hopefully it will explain what i'm looking for: this is for 6.5 but if N7 is better for this, i wouldn't complain

basically looking for a "cross back below the 10 line" and "cross back above the -10 line"


also, can anyone tell me if using the "CurrentBar.ToString" uses alot of CPU which may bog the chart down?

thx!

 
Code
double rsi   = avgDown[0] == 0 ? 100 : 100 - 100 / (1 + avgUp[0] / avgDown[0]);
   rsi = rsi - 50;
   double rsiAvg = (2.0 / (1 + Smooth)) * rsi + (1 - (2.0 / (1 + Smooth))) * Avg[1];
   Avg.Set(rsiAvg);
   Value.Set(rsi);
 
if (rsi[1] > 10 && rsi[0] < 9.95)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, High[0] + 4 * TickSize, Color.Red);
   }
 
 
if (rsi[1] < -10 && rsi[0] > -9.95)
   {
    DrawDot(CurrentBar.ToString() + "low", 0, Low[0]  -4 * TickSize, Color.Blue);
   }

Just from looking at the code: rsi is a variable of type double, so rsi[1] does not exist. If it is indexed, it is supposed to be a DataSeries. In this case you may try

 
Code
if (Value[1] > 10 && rsi < 9.95)
Not tested.

If you want to display all the dots, you need to identify each of them via a different string, so your approach is appropriate. That will indeed create a huge CPU load, which is a problem. Possible solution: only display the dots for a limited lookback period, for example

 
Code
if (Time[0] > DateTime.Now.AddDays(-3) && Value[1] > 10 && rsi < 9.95)
Again, not tested.

Reply With Quote
  #17 (permalink)
 
eDanny's Avatar
 eDanny 
East Rochester, NY
 
Experience: Intermediate
Platform: NT
Posts: 329 since Jul 2009
Thanks Given: 18
Thanks Received: 425

Or use a dot plot instead of draw objects.

Dan

Reply With Quote
  #18 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21

ok,

here is some code that compiles fine. can you tell me if this is going to use alot of CPU?

thx! v6.5

 
Code
Avg.Set(rsiAvg);
   Value.Set(rsi);
 
   // ABOVE 10 LINE CONDITIONS
 
   if (Time[0] > DateTime.Now.AddDays(-2) && Value [1] > 10 && rsi < tenLine)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, High[0] + 14 * TickSize, Color.Blue);
 
   }
   // ABOVE 0 LINE CONDITIONS
   if (Time[0] > DateTime.Now.AddDays(-2) && Value [1] > 0 && rsi < zeroLine)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, High[0] + 12 * TickSize, Color.Black);
   }
 
   // BELOW -10 LINE CONDITIONS
   if (Time[0] > DateTime.Now.AddDays(-2) && Value [1] < -10 && rsi > - tenLine)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, Low[0] - 14 * TickSize, Color.Blue);
   }
 
   // BELOW 0 LINE CONDITIONS
      if (Time[0] > DateTime.Now.AddDays(-2) && Value [1] < 0 && rsi > - zeroLine)
   {
    DrawDot(CurrentBar.ToString() + "high", 0, Low[0] - 12 * TickSize, Color.Black);
   }
 
Print(rsi);

Started this thread Reply With Quote
  #19 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,103


ceramictilepro View Post
ok,

here is some code that compiles fine. can you tell me if this is going to use alot of CPU?

thx! v[B]6.5

This code should not use a lot of CPU. But if you want to know, you can download Process Explorer from the Microsoft website and watch it running.

On Monday morning, you won't probably see any dots for Friday, so you may even increase your lookback period from 2 to 3 days.

Reply With Quote
  #20 (permalink)
 ceramictilepro 
Roseville CA
 
Experience: Advanced
Platform: N7
Broker: Amp Futures/CQG
Trading: ES
Posts: 124 since Jun 2009
Thanks Given: 32
Thanks Received: 21



Fat Tails View Post
This code should not use a lot of CPU. But if you want to know, you can download Process Explorer from the Microsoft website and watch it running.

On Monday morning, you won't probably see any dots for Friday, so you may even increase your lookback period from 2 to 3 days.


i didn't see a quick link or check box to say thanks so i'm writing it here.

THANKS Fat Tails!

this stuff is addicting!

Started this thread Reply With Quote




Last Updated on March 24, 2013


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts