Plotting change. Easy? - futures io
futures io futures trading



Plotting change. Easy?


Discussion in NinjaTrader

Updated
    1. trending_up 717 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

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

 
Search this Thread
 

Plotting change. Easy?

(login for full post details)
  #1 (permalink)
South Jordan UT
 
Experience: Intermediate
Platform: Ninjatrader
Trading: Forex
 
Posts: 15 since Jan 2013
Thanks: 6 given, 1 received

Hello all,

I got PMA indicator from public domain and I like to try using this for strategy. I am trying to modify PMA indicator into a strategy. But it doesn't work for me. I know I have a lot to learn. It is a simple program and I am not familiar with the differences between indicator and strategy plottings.

Would it be possible if you could just modify those lines below? I hope it is not too big of a task and is really simple. Is it doable?

Let me know.

Many thanks,
-traderjh


 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    /// <summary>
    /// Predictive Moving Average (ehlers)
    /// </summary>
    [Description("Predictive Moving Average (ehlers)")]
    public class PMA : Indicator
    {
        #region Variables
    // declare the variables here
        double WMA2;
        double Trigger;
		
    // create the dataseries here
	private DataSeries WMA1;
	private DataSeries Predict;
        #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 the plots here
            Add(new Plot(new Pen(Color.Blue, 3), PlotStyle.Line, "Predict_Plot"));
            Add(new Plot(new Pen(Color.Red, 3), PlotStyle.Line, "Trigger_Plot"));
            CalculateOnBarClose    = true;
            Overlay                = false;
            PriceTypeSupported    = true;
			
	// initialize dataseries here
	   WMA1 = new DataSeries(this);
	   Predict = new DataSeries(this);
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
	// if there isn't enough data just set the variables to 0
            if (CurrentBar < 7) 
            {
                WMA1.Set(0);
                WMA2 = 0;
                Predict.Set(0);
                Trigger = 0;
            }
	// else set the variables to the real values
            else
            {
		WMA1.Set((7*Median[0] + 6*Median[1] + 5*Median[2] + 4*Median[3] + 3*Median[4] + 2*Median[5] + Median[6])/28);
		WMA2 = (7*WMA1[0] + 6*WMA1[1] + 5*WMA1[2] + 4*WMA1[3] + 3*WMA1[4] + 2*WMA1[5] + WMA1[6])/28;
		Predict.Set(2*WMA1[0] - WMA2);
		Trigger = (4*Predict[0] + 3*Predict[1] + 2*Predict[2] + Predict[3])/10;
	}
			
	    // set the plots
		Predict_Plot.Set(Predict[0]);
		Trigger_Plot.Set(Trigger); 
        }

        #region Properties;
		// create the dataseries for the plots
        [Browsable(false)]   // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]       // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries Predict_Plot
        {
        get { return Values[0]; }
        }
        [Browsable(false)]   // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]       // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries Trigger_Plot
        {
        get { return Values[1]; }
        }
        #endregion

    }
}

Started this thread Reply With Quote

 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
111 thanks
Selling Options on Futures?
109 thanks
Rank your Futures vs Stocks trading priority
37 thanks
Want your NinjaTrader indicator created, free?
26 thanks
Bitcoin storage wallet recommendations
18 thanks


futures io Trading Community Platforms and Indicators NinjaTrader > Plotting change. Easy?


Last Updated on January 30, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



Copyright © 2021 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