Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Can't Compile!
Updated March 24, 2011
Top Posters
looks_one
sdt929
with 2 posts (0 thanks)
looks_two
fluxsmith
with 1 posts (0 thanks)
looks_3
Trader.Jon
with 1 posts (0 thanks)
looks_4
Quick Summary
with 1 posts (0 thanks)
trending_up
3,030 views
thumb_up
1 thanks given
group
3 followers
forum
5 posts
attach_file
2 attachments
Can't Compile!
March 23rd, 2011, 09:45 PM
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
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
March 23rd, 2011, 10:00 PM
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
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.
March 23rd, 2011, 11:44 PM
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
March 24th, 2011, 07:12 AM
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
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!
March 24th, 2011, 07:41 AM
Northern Germany
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824
sdt929
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
Last Updated on March 24, 2011