Need some help for c sharp scripting - NinjaTrader Programming | futures io social day trading
futures io futures trading

Need some help for c sharp scripting
Updated: Views / Replies:553 / 1
Created: by hugebaozi Attachments:0

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

Thread Tools Search this Thread

Need some help for c sharp scripting

  #1 (permalink)
Trading Apprentice
Futures Experience: Beginner
Platform: NinjaTrader
Favorite Futures: ES
Posts: 1 since Jul 2014
Thanks: 0 given, 0 received

Need some help for c sharp scripting

Hi all:
I am new to c# and ninjatrader.. and i tried to make some simple strategy work. Now i just to long SPY when sma(10)>sma(20) and sell the other way.
1. About Add(some indicators), could i also specify the color?
2. In my code , I first want to Add(sma10), it looks like i can't do this. So how could i initialize a indicator object?
3. In my code, I tried to call BackColorAll = Color.Green; Yet the backtest result does not show any green color on the chart though the trading log did execute some selling orders.
4. In general , my logic is to first check if my position is empty, if so, check the long condition. if my position is not empty, check the short condition.

Could someone help check where i goes wrong?
public class Crossover01 : Strategy
        #region Variables
        // Wizard generated variables
        private int myInput0 = 1; // Default setting for MyInput0
        // User defined variables (add any user defined variables below)

        /// <summary>
        /// This method is used to configure the strategy and is called once before any strategy method is called.
        /// </summary>
		private IOrder entryOrder = null;
        protected override void Initialize()
            CalculateOnBarClose = true;
			//global stop loss
			SetStopLoss(CalculationMode.Percent, 0.07);

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
			var sma10 = SMA(10);
			var sma20 = SMA(20);
			var sma50 = SMA(50);
			if(entryOrder == null)
				if(CrossAbove(sma10,sma20,1)&& Rising(sma50) == true)
					BackColorAll = Color.Red;
			else if (entryOrder != null)
				if (CrossBelow(sma10,sma20,1)|| Falling(sma50) == true)
					BackColorAll = Color.Green;
				entryOrder = null;

        #region Properties
        public int MyInput0
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }

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.


futures io > > > > > Need some help for c sharp scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

Wyckoff Hunting for Great Risk/Reward Ratio w/Gary Fullett

Elite only

Digging into the Details of iSystems w/Stage 5 & iSystems

Jun 5

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripting TWS on a Mac fritzybloch IB Trader Workstation 1 May 26th, 2016 10:56 AM
Does TWS Offer Built-In Scripting? TraitorX IB Trader Workstation 0 January 11th, 2014 11:50 PM
Sharp Slowdown in China Sparks Call for Fiscal Stimulus Quick Summary News and Current Events 0 May 14th, 2012 12:50 AM
Newbie scripter needs help scripting MT4 LWMA indicator kashix MetaTrader 1 April 27th, 2012 02:47 PM
IMF Says Threat of Sharp Global Slowdown Has Eased Quick Summary News and Current Events 0 March 2nd, 2012 12:40 AM

All times are GMT -4. The time now is 05:23 AM.

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
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 2018-05-25 in 0.07 seconds with 19 queries on phoenix via your IP