NexusFi: Find Your Edge


Home Menu

 





Can't Compile!


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sdt929 with 2 posts (0 thanks)
    2. looks_two Trader.Jon with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 vvhg with 1 posts (1 thanks)
    1. trending_up 3,019 views
    2. thumb_up 1 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread

Can't Compile!

  #1 (permalink)
 
sdt929's Avatar
 sdt929 
Dallas, Texas
 
Experience: Intermediate
Platform: NT
Broker: Amp/CQG
Trading: CL,ZB,TF
Posts: 17 since Sep 2009
Thanks Given: 46
Thanks Received: 27

I was trying to paste some new code into my strategy and now I can't get it to compile. I was hoping someone could take a look and see whats wrong.??? PLEASE!

Attached Files
Elite Membership required to download: TRYONEWUTHLIMITtwo.cs
Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 fluxsmith 
Santa Maria
 
Experience: Advanced
Platform: NinjaTrader, ThinkOrSwim
Broker: Mirus/Zen-Fire
Trading: ES
Posts: 290 since May 2010
Thanks Given: 97
Thanks Received: 322



sdt929 View Post
I was trying to paste some new code into my strategy and now I can't get it to compile. I was hoping someone could take a look and see whats wrong.??? PLEASE!

For starters you have two "protected override void OnBarUpdate()" code blocks. You'll have to consolidate them into one function.

Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 
sdt929's Avatar
 sdt929 
Dallas, Texas
 
Experience: Intermediate
Platform: NT
Broker: Amp/CQG
Trading: CL,ZB,TF
Posts: 17 since Sep 2009
Thanks Given: 46
Thanks Received: 27

Ok, not sure of what I am doing but one thing I am sure of....I don't know a thing about programming. lol I tried combining the 2 blocks and made things worse. Heres what I have done, if anyone wants to help! Thanks in advance for any help!

Attached Files
Elite Membership required to download: TRYONEWUTHLIMITtwo.cs
Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


sdt929 View Post
Ok, not sure of what I am doing but one thing I am sure of....I don't know a thing about programming. lol I tried combining the 2 blocks and made things worse. Heres what I have done, if anyone wants to help! Thanks in advance for any help!

Have you tried commenting out th lines that are throwing out errors in the compiler?

What errors are you getting?

TJ

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
  #6 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


sdt929 View Post
Ok, not sure of what I am doing but one thing I am sure of....I don't know a thing about programming. lol I tried combining the 2 blocks and made things worse. Heres what I have done, if anyone wants to help! Thanks in advance for any help!

Cleaned up a bit, though I cannot really see, what you are trying to do with that strat......
 
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.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>
    /// Enter the description of your strategy here
    /// </summary>
    [Description("Enter the description of your strategy here")]
    public class TRYONEWUTHLIMITtwo : Strategy
    {
        #region Variables
        // Wizard generated variables
        // 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()
        {
            SetProfitTarget("", CalculationMode.Ticks, 10);
            SetStopLoss("", CalculationMode.Ticks, 10, false);

            CalculateOnBarClose = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // Condition set 1
            if (Close[0] == High[0]
                && Close[1] == High[1])
            {
                EnterLong(DefaultQuantity, "1");
            }

            // Condition set 2
            if (Close[0] > High[1]
                && Close[1] > Close[1])
            {
                ExitLong("", "20");
            }
                        
            
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            
            
            
                // After our strategy has a PnL greater than $1000 or less that -$400 we will stop our strategy
                if (Performance.AllTrades.TradesPerformance.Currency.CumProfit > 1000
                    || Performance.AllTrades.TradesPerformance.Currency.CumProfit < -400)
                {
                    /* A custom method designed to close all open positions and cancel all working orders will be called.
                    This will ensure we do not have an unmanaged position left after we halt our strategy. */
                    StopStrategy();
                    
                    //Halt further processing of our strategy
                    return;
                
                }
                // Checks to see if the day of the week is Saturday or Sunday. Only allows trading if the day of the week is not Saturday or Sunday.
                if (Time[0].DayOfWeek != DayOfWeek.Saturday && Time[0].DayOfWeek != DayOfWeek.Sunday)
                 {
                    /* Checks to see if the time is during the following hours (format is HHMMSS or HMMSS). 
                   The timezone used here is (GMT-05:00) EST. */
                   if ((ToTime(Time[0]) >= 101500 && ToTime(Time[0]) <= 151500)) //|| (ToTime(Time[0]) >= 140000 && ToTime(Time[0]) < 154500))
                   {
                        if (Historical) return;}
                
                }
        }
            

        #region Properties
        #endregion
                }
            }
vvhg

Hic Rhodos, hic salta.
Reply With Quote
Thanked by:




Last Updated on March 24, 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