NexusFi: Find Your Edge


Home Menu

 





MTF WMA of RSI code help


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one gever17 with 3 posts (0 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 NinjaTrader with 1 posts (1 thanks)
    4. looks_4 vegasfoster with 1 posts (1 thanks)
    1. trending_up 4,272 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 gever17 
Cheyenne,Wyoming...USA
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: NQ, YM
Posts: 69 since Nov 2010
Thanks Given: 329
Thanks Received: 54

Hi all!!!!!!
I am stumped and hoping someone can help with this one.

I am trying to code an indy with a WMA using RSI as the Data Input Series.

To be more specific I am trying to get the 45 Weighted Moving Average of the RSI period 14 and smooth 3 in a selectable time frame setup.

This is the code that I think is the closest but still get errors on compile.
_RSIWMAfilter = (WMA(RSI(BarsArray[5],rSIperiod,rSIsmooth),WMAperiod));
or
_RSIWMAfilter = (WMA(RSI(Closes[5],rSIperiod,rSIsmooth),WMAperiod));

If anyone could show how the code should be written I would greatly appreciate it!!!

Thanks for taking the time to look!
gever17


Started this thread Reply With Quote

 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #3 (permalink)
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 845


I didn't do it a lot but I believe in the initialize() section you have to specify the time period using Add(Instrument, PeriodType.Minute, PeriodLength), e.g. Add(Instrument.FullName, PeriodType.Minute, 5) for the default intrument and a 5-minute time frame and then in your formula use Closes[1][0], where 1 represents the added data series.


Reply With Quote
Thanked by:
  #4 (permalink)
 gever17 
Cheyenne,Wyoming...USA
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: NQ, YM
Posts: 69 since Nov 2010
Thanks Given: 329
Thanks Received: 54

Hi VegasFoster,
Thanks for your input and taking your time to respond.

I am pretty sure I have that setup correct in Initialize as you have suggested. I am actually accessing the 5th Time Frame. As follows:
Add(PeriodType.Range, firstTF);
Add(PeriodType.Range, secondTF);
Add(PeriodType.Range, thirdTF);
Add(PeriodType.Range, mAXRangeChart);
Add(PeriodType.Range, rSIRangeChart);
I havent had any problems accessing any of the TFs for other parts of the indy.

I just cant seem to figure out how to write the code to get the WMA of RSI using a data series other than the chart it is place on.

Thanks again for you time!!!
gever17


Started this thread Reply With Quote
  #5 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,715 since May 2010
Thanks Given: 203
Thanks Received: 2,688


gever17 View Post
Hi all!!!!!!
I am stumped and hoping someone can help with this one.

I am trying to code an indy with a WMA using RSI as the Data Input Series.

To be more specific I am trying to get the 45 Weighted Moving Average of the RSI period 14 and smooth 3 in a selectable time frame setup.

This is the code that I think is the closest but still get errors on compile.
_RSIWMAfilter = (WMA(RSI(BarsArray[5],rSIperiod,rSIsmooth),WMAperiod));
or
_RSIWMAfilter = (WMA(RSI(Closes[5],rSIperiod,rSIsmooth),WMAperiod));

If anyone could show how the code should be written I would greatly appreciate it!!!

Thanks for taking the time to look!
gever17

Take a look at this, couple of ways to do this.

 
Code
 
protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
Overlay = false;
Add(PeriodType.Minute, 1);
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{ 
if (CurrentBar < 45)
return;
 
// This would execute on each OnBarUpdate() call for chart data series plus
// each added series in the indicator however, only the 1 minute series is passed in
//Plot0.Set(WMA(RSI(BarsArray[1], 14, 3), 45)[0]);
 
// OR
 
// This is executed only when OnBarUpdate() is called for the 1 minute series
if (BarsInProgress == 1)
Plot0.Set(WMA(RSI(Input, 14, 3), 45)[0]);
}


Follow me on X Reply With Quote
Thanked by:
  #6 (permalink)
 gever17 
Cheyenne,Wyoming...USA
 
Experience: Beginner
Platform: NinjaTrader
Broker: Mirus Futures/Zen-Fire
Trading: NQ, YM
Posts: 69 since Nov 2010
Thanks Given: 329
Thanks Received: 54

Hi NT,

Thank you very much for the help!!!!

Exactly the info I needed!

gever17


Started this thread Reply With Quote




Last Updated on March 31, 2011


© 2026 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 - Downloads - Top
no new posts