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 3,453 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
 

MTF WMA of RSI code help

 
 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

Can you help answer these questions
from other members on NexusFi?
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
Deepmoney LLM
Elite Quantitative GenAI/LLM
 
 
 vegasfoster 
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
Posts: 1,145 since Feb 2010
Thanks Given: 304
Thanks Received: 844


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.

Thanked by:
 
 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
 
 
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,713 since May 2010
Thanks Given: 203
Thanks Received: 2,686


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 Twitter
Thanked by:
 
 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

 



Last Updated on March 31, 2011


© 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