Symmetry - NinjaTrader Programming | futures io social day trading
futures io futures trading


Symmetry
Updated: Views / Replies:8,124 / 25
Created: by Maletor Attachments:9

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 dont 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
 9  
 
Thread Tools Search this Thread
 

Symmetry

  #1 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received

Symmetry

Here is my version of Mike's Symmetry.
My back test only goes back to 6/3 without crashing.

Maybe that's because I'm using a tick chart or who knows. It would be nice if it could go further back.

Anyways, I've been trying to optimize this to be more profitable. Right now it's pretty much break-even.

It could be that a 3 point simple bracket is not the right idea.

You're free to use this code as you like. Maybe if we can all work on it together we will finally come up with the Holy Grail

 
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 Symmetry : Strategy
    {
        #region Variables
        // Wizard generated variables
        private int myInput0 = 1; // Default setting for MyInput0
        // 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, 16);
            SetStopLoss("", CalculationMode.Ticks, 16, false);
            
            TraceOrders = true;
            CalculateOnBarClose = true;
        }

        /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
        {
            // For direction
            if(direction == "long")
                if(Close[0] < DoubleMA(34, NinjaTrader.Indicator.MAV.MAType.ADXVMA, 34, NinjaTrader.Indicator.MAV.MAType.EMA).RisingPlot[0]) 
                    direction = null;
                
            if(direction == "short")
                if(Close[0] > DoubleMA(34, NinjaTrader.Indicator.MAV.MAType.ADXVMA, 34, NinjaTrader.Indicator.MAV.MAType.EMA).FallingPlot[0]) 
                    direction = null;
                
            if(direction == "long")
                if (TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageType.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode.ATR).UpTrend[0] == 0)
                    direction = null;
            
            if(direction == "short")
                if (TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageType.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode.ATR).DownTrend[0] == 0)
                    direction = null;
            
            // For longs
            if (ECO2New2(7, 4, 21).Main[0] > 0 &&
                ECO2New2(7, 4, 21).Main[0] > ECO2New2(7, 4, 21).Signal[0]
                && ECO2New2(7, 4, 21).ECORising[0] != 0
                && TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageType.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode.ATR).UpTrend[0] != 0
                && Close[0] > DoubleMA(34, NinjaTrader.Indicator.MAV.MAType.ADXVMA, 34, NinjaTrader.Indicator.MAV.MAType.EMA).RisingPlot[0]
                && Close[0] > DoubleMA(16, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA, 16, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA).RisingPlot[0]
                //&& DoubleMA(14, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA, 1, NinjaTrader.Indicator.MAV.MAType.ADXVMA).NeutralPlot[0] == 0
                )
            {
                if(direction != "long")
                {
                    direction = "long";    
                    //DrawArrowUp("Up" + CurrentBar, true, 0, Low[0] - (4 * TickSize), Color.Lime);
                    //DrawText("Up info" + CurrentBar, Close[0].ToString("0.00"), 0, Low[0] - (10 * TickSize), Color.Lime);
                    //PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\long.wav");
                    EnterLong(1,"");
                }
            }
            
            // For shorts
            if (ECO2New2(7, 4, 21).Main[0] < 0 && 
                ECO2New2(7, 4, 21).Main[0] < ECO2New2(7, 4, 21).Signal[0]
                && ECO2New2(7, 4, 21).ECOFalling[0] != 0
                && TSSuperTrend(14, TradingStudies.NinjaScript.Utility.MovingAverageType.SMA, 2.618, 14, TradingStudies.NinjaScript.Utility.SuperTrendMode.ATR).DownTrend[0] != 0
                && Close[0] < DoubleMA(34, NinjaTrader.Indicator.MAV.MAType.ADXVMA, 34, NinjaTrader.Indicator.MAV.MAType.EMA).FallingPlot[0]
                && Close[0] < DoubleMA(16, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA, 16, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA).FallingPlot[0]
                //&& DoubleMA(14, NinjaTrader.Indicator.MAV.MAType.ZeroLagEMA, 1, NinjaTrader.Indicator.MAV.MAType.ADXVMA).NeutralPlot[0] == 0
                )
            {
                if(direction != "short")
                {
                    direction = "short";    
                    //DrawArrowDown("Down" + CurrentBar, true, 0, High[0] + (4 * TickSize), Color.Lime);
                    //DrawText("Down info" + CurrentBar, Close[0].ToString("0.00"), 0, High[0] + (10 * TickSize), Color.Lime);
                    //PlaySound(@"C:\Program Files\NinjaTrader 6.5\sounds\short.wav");
                    EnterShort(1,"");
                }
            }
        }

        #region Properties
        [Description("")]
        [Category("Parameters")]
        public string direction = null;
        #endregion
    }
}

Attached Thumbnails
Symmetry-picture-5-2-.png   Symmetry-picture-4-2-.png  
Reply With Quote
The following 2 users say Thank You to Maletor for this post:
 
  #2 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received

Hi Maletor,

Can you post the .CS file or better yet, File -> Utilities -> Export it and post the zip?

There is a hack to make ninja more stable with large backtests. I posted it here:
https://futures.io/ninjatrader-programming/76-ninjatrader-6-5-largeaddressaware-hack.html

Mike

Reply With Quote
 
  #3 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received


I'm still new at programming but I'm been experimenting with the ECO2 in discretionary trading.

Here was my idea. Maybe you could try this...





See screenshot http://screencast.com/t/5mV31Wku

Step 1:
Enter the trade on the 1st ECO entry signal after the eco line crosses the zero line IN THE DIRECTION OF THE OVERALL TREND LINE (MAYBE A 36 zerolag/zerolag dma).

Only taking trades in the direction of the longer timeframe trendline will hopefully avoid fakeouts without still allowing you to catch most of the profitable trades. Ive noticed lots of times you have 6e or ES going long or sideways, then you get a little down (to shake people out of their long positions or get others to go short), then a big move up to leave to crush the quick entry shorts and disappoint the early exit longs. It's max pain on a small scale. I see this over and over again. In fact, you can see it in the screenshot.

Then, money management.
Step 2a - Take one contract off at 6 ticks of profit (which should be very easy to do on 6e)
OR
Step 2b Take a stop loss on both contracts at 15 tick stop loss from entry point


Step 3 trail the 2nd contract with a progressively tightening trail stop.

Let me know what you think.


P.S.... I'm guessing that your code will only test back a few days because of contract rollover...but that is just a guess.

Todd

Reply With Quote
 
  #4 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received

Stupid thing won't zip it complaining it won't compile when that is a farce.

Here is the .CS while I see if I can figure out what is making it stick.

Thanks for the NT backtesting hack by the way.

Attached Files
Register to download File Type: cs Symmetry.cs (4.8 KB, 50 views)
Reply With Quote
 
  #5 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received

You mean take 6 tick profit and move to stop breakeven or keep at -15 ticks?

Are you using ModHA2 in that screenshot?

Mike, still no go with the export... CS file is all that works, but you can just create a new strategy and unlock code and copy and paste.

Reply With Quote
 
  #6 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received

Here is export.

Attached Files
Register to download File Type: zip Symmetry.zip (61.6 KB, 106 views)
Reply With Quote
 
  #7 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,355 given, 83,237 received


Maletor View Post
Here is export.

Cool.

You might try a different period, like 4 range, 6 range, etc. Maybe 1597 volume instead of tick, or 2584 volume, 4181 volume, etc.

It is hard to really know what this strategy will do with only 20 or so trades and a short time frame.

I will load it up over here and backtest it further back and share the results in a few minutes.

Edit: please upgrade to latest SuperTrend from SuperTrend thread on Ninja forums, can't backtest it properly until this is done.

Mike


Last edited by Big Mike; June 13th, 2009 at 05:31 PM. Reason: update
Reply With Quote
 
  #8 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received

You are right Todd, it is more about money management than anything else.

The only reason I would program a strategy is to hear that girl say "possible long signal" so I can watch a movie or something and come back to see what is materializing.

Reply With Quote
 
  #9 (permalink)
Elite Member
Alpharetta, GA
 
Futures Experience: Intermediate
Platform: ninja
Broker/Data: Mirus / Zenfire
Favorite Futures: ES
 
Todd's Avatar
 
Posts: 257 since Jun 2009
Thanks: 28 given, 40 received

Maletor,

I meant after 6 tick profit, move the stop on the remaining contract from -15 ticks to -6 or -5 ticks to guarantee at least a breakeven trade.

Yes...those are modha2 bars.

Todd

Reply With Quote
 
  #10 (permalink)
Member
Boston
 
Futures Experience: Beginner
Platform: Sierra Chart
Broker/Data: Infinity Futures/Transact
Favorite Futures: ES
 
Maletor's Avatar
 
Posts: 88 since Jun 2009
Thanks: 7 given, 26 received


Version 2.
Here is a simplified version that seems to be doing much better.

It's all so discretionary, but this strategy would be what I should program to alert me that something is happening. I would still have all the indicators on as in the first Sym and would be staying out of flat ECOs.

Attached Thumbnails
Symmetry-picture-6-2-.png   Symmetry-picture-7-2-.png  
Attached Files
Register to download File Type: zip Sym2.zip (58.8 KB, 101 views)
Reply With Quote

Reply



futures io > > > > > Symmetry

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone tried alternating-symmetry.com? Chipmunk Trading Reviews and Vendors 2 September 23rd, 2010 09:46 AM


All times are GMT -4. The time now is 03:58 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-17 in 0.14 seconds with 20 queries on phoenix via your IP 107.20.115.174