strategy development - NinjaTrader Programming | futures io social day trading
futures io futures trading


strategy development
Updated: Views / Replies:3,463 / 14
Created: by kavin729 Attachments:4

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

Reply
 4  
 
Thread Tools Search this Thread
 

strategy development

  #1 (permalink)
Trading Apprentice
 
Futures Experience: Beginner
Platform: ninjatrader
Favorite Futures: ES
 
Posts: 8 since Jan 2010
Thanks: 8 given, 0 received

strategy development

Hi friends I have created this strategy after seeing big mike video.
Please help me fix its errors,Targets and stoploss not working properly
I want to enter 10 lots
target 1 : book 6 lots
target 2 : book 2 lots
target 3 ; book 2 lots

want to keep initial stoploss below low or high of entry bar
then after target 1 ,moved below low or high of target 1 bar then to target 2 bar .
cheers
 
Code
                            
//#region Variables
        
private int        smalength        200;
        private 
int        emalength        100;
        private 
int        hmalength        40;
        
        private 
int        target1            100;
        private 
int        target2            200;
        private 
int        target3            300;
        
        private 
int        stop            500;
        
        private 
bool    be2                true;
        private 
bool    be3                true;
        
        
        
//#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;
            
EntryHandling        EntryHandling.UniqueEntries;
            
            
Add(SMA(Close,HMAlength));
            
Add(EMA(Close,HMAlength));
            
Add(HMA(Close,HMAlength));
            
        }
        
        private 
void GoLong()
        {
            
SetStopLoss("target1"CalculationMode.PriceClose[0] - (Stop*TickSize), false);
            
SetStopLoss("target2"CalculationMode.PriceClose[0] - (Stop*TickSize), false);
            
SetStopLoss("target3"CalculationMode.PriceClose[0] - (Stop*TickSize), false);
            
            
SetProfitTarget("target1"CalculationMode.PriceClose[0] + (Target1*TickSize));
            
SetProfitTarget("target2"CalculationMode.PriceClose[0] + ((Target1+Target2)*TickSize));
            
SetProfitTarget("target3"CalculationMode.PriceClose[0] + ((Target1+Target2+Target3)*TickSize));
            
            
EnterLong("target1");
            
EnterLong("target2");
            
EnterLong("target3");
            
            
        }
        private 
void GoShort()
        {
            
SetStopLoss("target1"CalculationMode.PriceClose[0] + (Stop*TickSize), false);
            
SetStopLoss("target2"CalculationMode.PriceClose[0] + (Stop*TickSize), false);
            
SetStopLoss("target3"CalculationMode.PriceClose[0] + (Stop*TickSize), false);
            
            
SetProfitTarget("target1"CalculationMode.PriceClose[0] - (Target1*TickSize));
            
SetProfitTarget("target2"CalculationMode.PriceClose[0] - ((Target1+Target2)*TickSize));
            
SetProfitTarget("target3"CalculationMode.PriceClose[0] - ((Target1+Target2+Target3)*TickSize));
            
            
EnterShort("target1");
            
EnterShort("target2");
            
EnterShort("target3");
            
            
        }
        
        private 
void ManageOrders()
        {
            if (
Position.MarketPosition == MarketPosition.Long)
            {
                if (
BE2 && High[0] > Position.AvgPrice + (Target1*TickSize))
                    
SetStopLoss("target2"CalculationMode.PricePosition.AvgPricefalse);
                
                if (
BE3 && High[0] > Position.AvgPrice + ((Target1+Target2)*TickSize))
                    
SetStopLoss("target3"CalculationMode.PricePosition.AvgPricefalse);
            
            }
            if (
Position.MarketPosition == MarketPosition.Short)
            {
                if (
BE2 && Low[0] < Position.AvgPrice - (Target1*TickSize))
                    
SetStopLoss("target2"CalculationMode.PricePosition.AvgPricefalse);
                
                if (
BE3 && Low[0] < Position.AvgPrice - ((Target1+Target2)*TickSize))
                    
SetStopLoss("target3"CalculationMode.PricePosition.AvgPricefalse);
            
            }
            
        }

        
/// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        
protected override void OnBarUpdate()
        {
            
EntryHandling        EntryHandling.UniqueEntries;
            
            
SMA        smav        SMA(SMAlength);
            
EMA        emav        EMA(EMAlength);
            
HMA        hmav        HMA(HMAlength);
            
            
ManageOrders();
            
            if (
Position.MarketPosition != MarketPosition.Flat) return;
            
            if (
Rising(smav) && Rising(emav) && Rising(hmav))
                
GoLong();
            else
            if (
Falling(smav) && Falling(emav) && Falling(hmav))
                
GoShort();
            
        }

        
//#region Properties
        
[Description("")]
        [
Category("Parameters")]
        public 
int SMAlength
        
{
            
get { return smalength; }
            
set smalength Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int EMAlength
        
{
            
get { return emalength; }
            
set emalength Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int HMAlength
        
{
            
get { return hmalength; }
            
set hmalength Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int Target1
        
{
            
get { return target1; }
            
set target1 Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int Target2
        
{
            
get { return target2; }
            
set target2 Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int Target3
        
{
            
get { return target3; }
            
set target3 Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
int Stop
        
{
            
get { return stop; }
            
set stop Math.Max(1value); }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
bool BE2
        
{
            
get { return be2; }
            
set be2 value; }
        }
        [
Description("")]
        [
Category("Parameters")]
        public 
bool BE3
        
{
            
get { return be3; }
            
set be3 value; }
        }
        
        
        
//#endregion
    
}



Last edited by sam028; September 2nd, 2010 at 07:38 AM. Reason: nicer with PHP tag
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.

 
  #3 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received


Which NT version are you using?

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
 
Futures Experience: Beginner
Platform: ninjatrader
Favorite Futures: ES
 
Posts: 8 since Jan 2010
Thanks: 8 given, 0 received


zeller4 View Post
Which NT version are you using?

zeller it is 6.5,but can use 7 also

Reply With Quote
 
  #5 (permalink)
Just starting out...
Australia (ex UK)
 
Futures Experience: Advanced
Platform: IB TWS, IRESS, SC, (ex MC,NT)
 
Posts: 26 since Aug 2010
Thanks: 14 given, 27 received

I am a complete novice programmer, but could it be that the names target1, target2....etc
are repeated for longs and shorts..... and when trying to work out a target for a long v a short, one is above the market, the other below the market, which stuffs up future max, and min calculations.

Try calling them LongTarget1, ShortTarget1 see if that makes a difference.

Reply With Quote
The following user says Thank You to MotoMoto for this post:
 
  #6 (permalink)
Trading Apprentice
 
Futures Experience: Beginner
Platform: ninjatrader
Favorite Futures: ES
 
Posts: 8 since Jan 2010
Thanks: 8 given, 0 received


MotoMoto View Post
I am a complete novice programmer, but could it be that the names target1, target2....etc
are repeated for longs and shorts..... and when trying to work out a target for a long v a short, one is above the market, the other below the market, which stuffs up future max, and min calculations.

Try calling them LongTarget1, ShortTarget1 see if that makes a difference.

qty done ,someone please help me with trailing stoploss

Reply With Quote
 
  #7 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


kavin729 View Post
qty done ,someone please help me with trailing stoploss

Have you looked at other strategies posted in the elite downloas? I think the hurley might be modified to do what you are doing ... but I could be wrong as it sbeen awhile since I looked at it in detail

Jon

Reply With Quote
The following user says Thank You to Trader.Jon for this post:
 
  #8 (permalink)
Trading Apprentice
 
Futures Experience: Beginner
Platform: ninjatrader
Favorite Futures: ES
 
Posts: 8 since Jan 2010
Thanks: 8 given, 0 received


Trader.Jon View Post
Have you looked at other strategies posted in the elite downloas? I think the hurley might be modified to do what you are doing ... but I could be wrong as it sbeen awhile since I looked at it in detail

Jon

don't have access to elite circle
don't want to donate cash but want to learn, share, contribute and help so that some day I am considered worthy enough to be given access to elite circle to enhance my knowledge amongst the best traders of bigmiketrading forum

kavin

Reply With Quote
 
  #9 (permalink)
Elite Member
U.S.A.
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 19 since May 2010
Thanks: 5 given, 11 received

Invest in Yourself. Invest in your education.

Kevin,

This is only 50 bucks to join the Elite! I believe this is an investment in your learning. Look at as buying a
book or buying a beginning education. I've never done subroutines in C Sharp. Try writing this all in one
mainline.

Reply With Quote
The following user says Thank You to bill897 for this post:
 
  #10 (permalink)
Elite Member
U.S.A.
 
Futures Experience: Advanced
Platform: NinjaTrader
 
Posts: 19 since May 2010
Thanks: 5 given, 11 received

Kavin, I used another different breakeven strategy


Kavin,

I tested another strategy that I hope you will enjoy using your code and adding breakeven, trailing stop
routine I copied from somewhere else here at Big Mike's. This strategy tests out at 39.81% and has a profit
of $31,440. You can probably perfect it. I'd like to see what you can do with it as follows:

Attached Thumbnails
strategy development-bg_main.jpg  
Attached Files
Register to download File Type: cs Strat1.cs (6.2 KB, 47 views)
Reply With Quote
The following user says Thank You to bill897 for this post:

Reply



futures io > > > > > strategy development

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Building a PC for Discretionary/Automated Trading and Strategy Development nlhaines Tech Support 50 January 13th, 2017 06:18 PM
Perrys Trading -> Strategy - development wgreenie NinjaTrader Programming 259 October 21st, 2015 02:22 PM
Strategy development GOM CD divergence chipotlebop The Elite Circle 72 April 14th, 2014 10:41 AM
Custom development neb1998 NinjaTrader Programming 1 March 7th, 2011 04:43 PM
Strategy development suprsnipes NinjaTrader Programming 1 March 2nd, 2010 11:45 PM


All times are GMT -4. The time now is 03:36 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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 2017-12-12 in 0.13 seconds with 20 queries on phoenix via your IP 54.163.210.170