Could you help me with this plot??? - NinjaTrader Programming | futures io social day trading
futures io futures trading


Could you help me with this plot???
Updated: Views / Replies:1,500 / 2
Created: by andaluz Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Could you help me with this plot???

  #1 (permalink)
Elite Member
cadiz
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: interactive brokers
Favorite Futures: stocks
 
Posts: 4 since Nov 2009
Thanks: 2 given, 1 received

Could you help me with this plot???

Hi, everyone!

I would like to plot when rsi crosses 40 line, but I'm failing in something and I don't know where is failing. Could you help me?

I paste:
 
Code
                            
public class _Alerts_MiRSI Indicator
    
{
        
#region Variables
        
private DataSeries                    avgUp;
        private 
DataSeries                    avgDown;
        private 
DataSeries                    down;
        private 
int                                period    14;
        private 
int                                smooth    3;
        private 
DataSeries                    up;
        
#endregion

        /// <summary>
        /// This method is used to configure the indicator and is called once before any bar data is loaded.
        /// </summary>
        
protected override void Initialize()
        {
            
Add(new Plot(Color.Green"MiRSI"));
            
Add(new Plot(Color.Orange"Avg"));

            
Add(new Line(System.Drawing.Color.DarkViolet20"Lower20"));
            
Add(new Line(System.Drawing.Color.DarkViolet80"Upper80"));
            
Add(new Line(System.Drawing.Color.Red60"Lower60"));
            
Add(new Line(System.Drawing.Color.Red40"Upper40"));
            
Add(new Line(System.Drawing.Color.Blue50"Upper50"));
            
            
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line"Alarma"));
            

            
avgUp                = new DataSeries(this);
            
avgDown                = new DataSeries(this);
            
down                = new DataSeries(this);
            
up                    = new DataSeries(this);

            
PriceTypeSupported    true;
        }

        
/// <summary>
        /// Calculates the indicator value(s) at the current index.
        /// </summary>
        
protected override void OnBarUpdate()
        {
            if (
CurrentBar == 0)
            {
                
down.Set(0);
                
up.Set(0);
                return;
            }

            
down.Set(Math.Max(Input[1] - Input[0], 0));
            
up.Set(Math.Max(Input[0] - Input[1], 0));

            if ((
CurrentBar 1) < Period
            {
                if ((
CurrentBar 1) == (Period 1))
                    
Avg.Set(50);
                return;
            }

            if ((
CurrentBar 1) == Period
            {
                
// First averages 
                
avgDown.Set(SMA(downPeriod)[0]);
                
avgUp.Set(SMA(upPeriod)[0]);
            }  
            else 
            {
                
// Rest of averages are smoothed
                
avgDown.Set((avgDown[1] * (Period 1) + down[0]) / Period);
                
avgUp.Set((avgUp[1] * (Period 1) + up[0]) / Period);
            }

            
double rs      avgUp[0] / (avgDown[0] == avgDown[0]);
            
double rsi      100 - (100 / (rs));
            
double rsiAvg = (2.0 / (Smooth)) * rsi + (- (2.0 / (Smooth))) * Avg[1];

            
Avg.Set(rsiAvg);
            
Value.Set(rsi);
            
            
Alarma.Set(rsi[1] < Upper40[1]&&rsi[0] > Upper40[0] ? 0);
        }

        
#region Properties
        /// <summary>
        /// </summary>
        
[Browsable(false)]
        [
XmlIgnore()]
        public 
DataSeries Avg
        
{
            
get { return Values[1]; }
        }

        
/// <summary>
        /// </summary>
        
[Browsable(false)]
        [
XmlIgnore()]
        public 
DataSeries Default
        {
            
get { return Values[0]; }
        }
        
        
/// <summary>
        /// </summary>
        
[Description("Numbers of bars used for calculations")]
        [
Category("Parameters")]
        public 
int Period
        
{
            
get { return period; }
            
set period Math.Max(2value); }
        }

        
/// <summary>
        /// </summary>
        
[Description("Number of bars for smoothing")]
        [
Category("Parameters")]
        public 
int Smooth
        
{
            
get { return smooth; }
            
set smooth Math.Max(1value); }
        }
        
        
            
            
        
        
        
#endregion
    
}
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    public 
partial class Indicator IndicatorBase
    
{
        private 
_Alerts_MiRSI[] cache_Alerts_MiRSI null;

        private static 
_Alerts_MiRSI check_Alerts_MiRSI = new _Alerts_MiRSI();

        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
public _Alerts_MiRSI _Alerts_MiRSI(int periodint smooth)
        {
            return 
_Alerts_MiRSI(Inputperiodsmooth);
        }

        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
public _Alerts_MiRSI _Alerts_MiRSI(Data.IDataSeries inputint periodint smooth)
        {
            
check_Alerts_MiRSI.Period period;
            
period check_Alerts_MiRSI.Period;
            
check_Alerts_MiRSI.Smooth smooth;
            
smooth check_Alerts_MiRSI.Smooth;

            if (
cache_Alerts_MiRSI != null)
                for (
int idx 0idx cache_Alerts_MiRSI.Lengthidx++)
                    if (
cache_Alerts_MiRSI[idx].Period == period && cache_Alerts_MiRSI[idx].Smooth == smooth && cache_Alerts_MiRSI[idx].EqualsInput(input))
                        return 
cache_Alerts_MiRSI[idx];

            
_Alerts_MiRSI indicator = new _Alerts_MiRSI();
            
indicator.BarsRequired BarsRequired;
            
indicator.CalculateOnBarClose CalculateOnBarClose;
            
indicator.Input input;
            
indicator.Period period;
            
indicator.Smooth smooth;
            
indicator.SetUp();

            
_Alerts_MiRSI[] tmp = new _Alerts_MiRSI[cache_Alerts_MiRSI == null cache_Alerts_MiRSI.Length 1];
            if (
cache_Alerts_MiRSI != null)
                
cache_Alerts_MiRSI.CopyTo(tmp0);
            
tmp[tmp.Length 1] = indicator;
            
cache_Alerts_MiRSI tmp;
            
Indicators.Add(indicator);

            return 
indicator;
        }

    }
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
    public 
partial class Column ColumnBase
    
{
        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
[Gui.Design.WizardCondition("Indicator")]
        public 
Indicator._Alerts_MiRSI _Alerts_MiRSI(int periodint smooth)
        {
            return 
_indicator._Alerts_MiRSI(Inputperiodsmooth);
        }

        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
public Indicator._Alerts_MiRSI _Alerts_MiRSI(Data.IDataSeries inputint periodint smooth)
        {
            return 
_indicator._Alerts_MiRSI(inputperiodsmooth);
        }

    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public 
partial class Strategy StrategyBase
    
{
        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
[Gui.Design.WizardCondition("Indicator")]
        public 
Indicator._Alerts_MiRSI _Alerts_MiRSI(int periodint smooth)
        {
            return 
_indicator._Alerts_MiRSI(Inputperiodsmooth);
        }

        
/// <summary>
        /// The MiRSI (Relative Strength Index) is a price-following oscillator that ranges between 0 and 100.
        /// </summary>
        /// <returns></returns>
        
public Indicator._Alerts_MiRSI _Alerts_MiRSI(Data.IDataSeries inputint periodint smooth)
        {
            if (
InInitialize && input == null)
                throw new 
ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return 
_indicator._Alerts_MiRSI(inputperiodsmooth);
        }

    }
}
#endregion 
Thank you in advance
Greetings from Spain, andaluz.

Attached Files
Register to download File Type: cs AlertsMiRSi.cs (8.1 KB, 7 views)

Last edited by sam028; May 31st, 2010 at 04:02 AM. Reason: add coding tag
Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary


(1) You used Alarma.Set, but you have not defined any DataSeries for it. Actually Alarma[] only takes the values 0 or 1, so you would need to define a BoolSeries under properties:

public BoolSeries Alarma
{
get{return values[2];}
}

(2) Also you have not defined any DataSeries Upper40[]. If you add a new line, this does not create a dataseries, if you add a new plot, you would need to declare the dataseries under properties....

(3) There is no dataseries rsi[], but you have called this dataseries Default, so you need to use Default!

The code for line 102 should therefore read

Alarma.Set(Default[1] < 40 && Default[0] > 40);

which sets a Boolean value to Alarma....

Have not checked this, but you should be able to work it out...

Reply With Quote
The following user says Thank You to Fat Tails for this post:

Reply



futures io > > > > > Could you help me with this plot???

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Why the SMI5 plot two dots? roadshow NinjaTrader 7 January 4th, 2017 11:16 PM
Why wont this plot in NT7 esscalper NinjaTrader Programming 3 August 16th, 2011 08:21 AM
plot without DataBox baberg NinjaTrader Programming 5 August 15th, 2011 06:36 PM
Plot only if true Locust EasyLanguage Programming 3 October 27th, 2010 03:30 PM
PLEASE! Need assist to make this plot Trader.Jon NinjaTrader Programming 4 September 27th, 2010 01:42 PM


All times are GMT -4. The time now is 02:32 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-15 in 0.09 seconds with 20 queries on phoenix via your IP 54.226.132.197