• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing Trading System

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Swing Trading System

    #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>
    /// Trades like a scalper
    /// </summary>
    [Description("Trades like a Swing Trader")]
    public class LineInSand : Strategy
    {
    #region Variables
    // Wizard generated variables
    private double pricepivot = 2830.00; // Default setting for Pricepivot
    private int tickprofit = 160; // Default setting for Tickprofit
    private int tickstoploss = 16; // Default setting for Tickstoploss
    private int trailtick = 40; // Default setting for Trailtick
    private int quantity = 1;
    private int starttime = 83000;
    private int stoptime = 160000;
    private int startdate = 20190101;
    private int stopdate = 20191231;
    // 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()
    {


    Add(CurrentDayOHL());

    SetProfitTarget("", CalculationMode.Ticks, Tickprofit);
    SetTrailStop("", CalculationMode.Ticks, Tickstoploss, true);
    SetTrailStop("", CalculationMode.Ticks, Trailtick, true);
    CalculateOnBarClose = true;
    }
    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {
    if (ToDay(Time[0])>= startdate && ToDay(Time[0]) <= stopdate)
    {
    if ((ToTime(Time[0]) >= starttime && ToTime(Time[0]) <= stoptime))
    {

    // Condition set 1
    if (Close[0] > Pricepivot)

    {

    DrawText("Buy!" + CurrentBar, "Buy!", 0, -2, Color.ForestGreen);
    EnterLong(Quantity, "");
    }
    // Condition set 2
    if (Close[0] < Pricepivot)

    {

    DrawText("Sell!" + CurrentBar, "Sell!", 0, 2, Color.DeepPink);
    EnterShort(Quantity, "");
    }

    }
    }
    }

    #region Properties

    [Description("pivot")]
    [GridCategory("Parameters")]
    public double Pricepivot
    {
    get { return pricepivot; }
    set { pricepivot = Math.Max(1, value); }
    }

    [Description("tick profit")]
    [GridCategory("Parameters")]
    public int Tickprofit
    {
    get { return tickprofit; }
    set { tickprofit = Math.Max(1, value); }
    }
    [Description("quantity")]
    [GridCategory("Parameters")]
    public int Quantity
    {
    get { return quantity; }
    set { quantity = Math.Max(1, value); }
    }
    [Description("tick stoploss")]
    [GridCategory("Parameters")]
    public int Tickstoploss
    {
    get { return tickstoploss; }
    set { tickstoploss = Math.Max(1, value); }
    }
    [Description("trail tick stop")]
    [GridCategory("Parameters")]
    public int Trailtick
    {
    get { return trailtick; }
    set { trailtick = Math.Max(1, value); }
    }


    [Description("")]
    [GridCategory("Parameters")]

    public int Startdate
    {
    get { return startdate; }
    set { startdate = Math.Max(1, value); }
    }

    [Description("")]
    [GridCategory("Parameters")]

    public int Stoptdate
    {
    get { return stopdate; }
    set { stopdate = Math.Max(1, value); }
    }

    [Description("")]
    [GridCategory("Parameters")]
    public int Starttime
    {
    get { return starttime;}
    set { starttime = Math.Max(1, value); }
    }

    [Description("")]
    [GridCategory("Parameters")]
    public int Stoptime
    {
    get { return stoptime; }
    set { stoptime = Math.Max(1, value); }
    }

    #endregion

    }
    }

    #2
    It basically can be used where the pivot can be set, the pivot defines entry bias of each trade placed. Time of system start and date of system start can be modified. If you were trading a news event. You basically put the date and time of economic report. And also input your pivot point. It aims for home runs and small losses. The daily pivot is key.

    Comment


      #3
      Case Study 1: NFP 11/1/19

      Comment


        #4
        Case Study 2: FOMC 10/30/19

        Comment


          #5
          If you place the pivot within a congestion zone, the zig zag trades will accumulate fast. Its best to define a pivot as an outlier.

          Comment


            #6
            Case Study 3: Jap Session 11/6/19

            Comment


              #7
              Case Study 4: FOMC 9/18/19

              Comment


                #8
                FOMC 9/18/19 Zig Zag trades .. pivot 2995

                Comment


                  #9
                  FOMC 10/3019 Pivot 3033

                  Comment


                    #10
                    Science of 'pivot outliers' .. It can be anything that is a recent statistical outlier .. x bars back the high or low of price from news event time. How could one further automate the system. Add multiple date fields so all FOMC and NFP days/times or economic reports can be put in ahead of time. In a upward trending market, the pivot outliers are mostly on the low side ranges. Since upward markets consolidate in the upper range, the pivot outlier has less chance of zig zag trades accruing costs.
                    Last edited by Kubera2024; 11-06-2019, 07:34 PM.

                    Comment


                      #11
                      A totally efficient market would be flat lined meaning price would be within a tight range. A news event, only step up or down to the next level to the next tight range. The alpha is in creating news events or knowing about the news events ahead of time. Or front running by micro seconds the news event. Explains why the world and the elite create events and front run the events before the general market does.

                      Comment


                        #12
                        With the advent of MES derivative, the above system can be modified where escalating unit size is added at each trade or cross of pivot. This is the only way consolidative patterns can be used against themselves. It also implies a relatively decent size bank roll to handle the unit size.

                        Comment


                          #13
                          Last night: Pivot 3067

                          Even if the 4 point stop got hit on retrace, the system would have went long immediately.
                          Last edited by Kubera2024; 11-07-2019, 05:23 AM.

                          Comment


                            #14
                            Hello Kubera2024,

                            Thanks for sharing your study.

                            In order to keep the forums concise and topics easy to follow, please keep your threads short and avoid double posting or adding additional replies before any other feedback is received. Please use the Edit Post feature to add new information to your opening post.

                            Please let us know if you have any questions.
                            JimNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Uregon, Today, 09:08 AM
                            1 response
                            6 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by swcooke, Today, 09:09 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post swcooke
                            by swcooke
                             
                            Started by Induna, Today, 08:44 AM
                            1 response
                            5 views
                            0 likes
                            Last Post NinjaTrader_ChelseaB  
                            Started by TangoTX, Today, 08:36 AM
                            1 response
                            1 view
                            0 likes
                            Last Post NinjaTrader_Tyler  
                            Started by abdullah, 11-15-2017, 08:44 PM
                            11 responses
                            822 views
                            0 likes
                            Last Post NinjaTrader_Kate  
                            Working...
                            X