• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What is wrong with this code?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    What is wrong with this code?

    Hi There,

    I cant see whats wrong with this code but I keep getting errors on compilation,

    #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.Indicator;
    using NinjaTrader.Gui.Chart;
    using NinjaTrader.Strategy;
    #endregion

    // This namespace holds all strategies and is required. Do not change it.
    namespace NinjaTrader.Strategy
    {
    /// <summary>
    /// Strategy to calcutale best moving averages.
    /// </summary>
    [Description("Strategy to calcutale best moving averages.")]
    public class EMACROSSBASIC : Strategy
    {
    private int emaf = 10;
    private int emas = 50;
    #region Variables
    // Wizard generated variables
    private int myInput0 = 1; // Default setting for MyInput0
    // User defined variables (add any user defined variables below)
    #endregion

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    {
    CalculateOnBarClose = true;
    ExitOnClose = false;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;

    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    EMA emavf = EMA (EMAf);
    EMA emavs = EMA (EMAs);


    //ManageOrders();

    if (EMA (EMAf) [0] < EMA (EMAs) [0]) GoShort();
    if (EMA (EMAf) [0] > EMA (EMAs) [0]) GoLong();


    }

    #region Properties
    [Description("")]
    [GridCategory("Parameters")]
    public int EMAf
    {
    get { return emaf; }
    set { emaf = Math.Max(1, value); }
    }
    [Description("")]
    [GridCategory("Parameters")]
    public int EMAs
    {
    get { return emas; }
    set { emas = Math.Max(1, value); }
    }
    #endregion
    }
    }




    Thanks for any help.

    #2
    Hello GKonheiser,
    NinjaTrder does not have any method/functions namely GoShort or GoLong. If they are custom methods then please make sure you have included the same.

    Code:
    if (EMA (EMAf) [0] < EMA (EMAs) [0]) GoShort();
    if (EMA (EMAf) [0] > EMA (EMAs) [0]) GoLong();
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Yes sorry I just saw that. thanks

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by EnveousColnago, Yesterday, 05:43 PM
      7 responses
      37 views
      0 likes
      Last Post Lancer
      by Lancer
       
      Started by PeterGolz, 01-17-2020, 10:42 AM
      11 responses
      73 views
      0 likes
      Last Post reubenlasky  
      Started by utilizator, Today, 11:36 AM
      0 responses
      6 views
      0 likes
      Last Post utilizator  
      Started by EnveousColnago, Today, 07:24 AM
      1 response
      11 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by tornadoatc, Today, 10:31 AM
      0 responses
      4 views
      0 likes
      Last Post tornadoatc  
      Working...
      X