Strategy Help - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

Strategy Help
Started:March 31st, 2011 (06:16 PM) by sdt929 Views / Replies:619 / 1
Last Reply:March 31st, 2011 (06:16 PM) Attachments:2

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

Strategy Help

Old March 31st, 2011, 06:16 PM   #1 (permalink)
Elite Member
Dallas, Texas
Futures Experience: Intermediate
Platform: NT
Broker/Data: Amp/CQG
Favorite Futures: CL,ZB,TF
sdt929's Avatar
Posts: 17 since Sep 2009
Thanks: 45 given, 27 received

Strategy Help

Could someone please copy and paste the code from SampleAdvancedAutomatedStrat to my ThreeBarsLONG strategy? I have tried and tried but I can't get it to ever compile. I know the ThreeBarsLONG strategy is simple and probably not really good (more for example than anything) but I am trying to learn a little and if I could see where the code should be placed and the right way to do it I think I would understand what I'm doing wrong. I will attach both strategies below plus paste the code I'm trying to use. If anyone wants to take the time to look at it for me......THANK YOU!

protected override void OnBarUpdate()
// After our strategy has a PnL greater than $1000 or less than -$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. */

// Halt further processing of our strategy
// 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;

Attached Files
Register to download File Type: cs SampleAdvancedAutomatedStratv1point1.cs (16.1 KB, 11 views)
Register to download File Type: cs ThreeBarsLONG.cs (22.1 KB, 8 views)
Reply With Quote

Old March 31st, 2011, 06:16 PM   #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.


Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > Strategy Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Call ATM Strategy on an automated strategy to control position jsengxx NinjaTrader Programming 7 May 31st, 2016 04:51 PM
Utility To Transpose Optimized Strategy Values From Excel Output to Actual Strategy mercuryfx NinjaTrader 5 April 7th, 2012 03:59 PM
Ninjatrader7 ATM Strategy combine with Strategy Wizard Ninja Script schuster21 NinjaTrader Programming 4 July 4th, 2011 04:39 PM
Ninja Strategy multi-timeframe issue/Strategy to indicator nw123 NinjaTrader Programming 2 December 20th, 2009 06:24 PM

All times are GMT -4. The time now is 02:46 PM.

Copyright © 2016 by 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 2016-10-21 in 0.09 seconds with 20 queries on phoenix via your IP