Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mash Trading Systems

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

    #16
    Unfortunately even with these corrections this still does not work. the system just takes a long on the 7th bars. See pic.. Also another issue is it never puts two triangles on the same bar. if you look at the pic i have one blue triangle and one red triangle. they never paint on the same bar. it is either one or the other. I think the system does not recognize that i have two independent trading system running instead it just sees it as a condition and picks just one. I THINK

    Code:
    // 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 MASHALL : Strategy
        {
            #region Variables
            // Wizard generated variables
            private int myInput0 = 1; // Default setting for MyInput0
    		private bool enterLongStrat1 = false;
    		private bool enterLongStrat2= false;
    	    // 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()
            {
            CalculateOnBarClose = true;
    	
    		
    		}
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
    			
    			
                // Strategy 1
    			if (Bars.BarsSinceSession >=7)
    	        if (Stochastics(7, 14, 3).D[0] >= 30)
                {
                    enterLongStrat1 = true;
    		//		enterLongStrat2 = false;
    				DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 20 * TickSize, Color.Red);
    				
                }
    			
    			//Strategy 2
    			if (Bars.BarsSinceSession >=7)
    				
    			if ( Close[0] >= EMA(30)[0])
                {
                    enterLongStrat2 = true;
    		//		enterLongStrat1 = false; now, then both conditions can never be simultaneously true if you have this
    				DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 30 * TickSize, Color.Blue);
    				
                }
    			
    			if (Bars.BarsSinceSession >=7)
    			if(enterLongStrat2 == true && enterLongStrat1 == true)
    			{    
      				EnterLong(DefaultQuantity, "");
    				
    			}
            }
    
            #region Properties
            [Description("")]
            [GridCategory("Parameters")]
            public int MyInput0
            {
                get { return myInput0; }
                set { myInput0 = Math.Max(1, value); }
            }
    
    	
    		
            #endregion
        }
    }
    Attached Files

    Comment


      #17
      Originally posted by wallsteetking View Post
      Unfortunately even with these corrections this still does not work. the system just takes a long on the 7th bars. See pic.. Also another issue is it never puts two triangles on the same bar. if you look at the pic i have one blue triangle and one red triangle. they never paint on the same bar. it is either one or the other. I think the system does not recognize that i have two independent trading system running instead it just sees it as a condition and picks just one. I THINK

      Code:
      // 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 MASHALL : Strategy
          {
              #region Variables
              // Wizard generated variables
              private int myInput0 = 1; // Default setting for MyInput0
      		private bool enterLongStrat1 = false;
      		private bool enterLongStrat2= false;
      	    // 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()
              {
              CalculateOnBarClose = true;
      	
      		
      		}
      
              /// <summary>
              /// Called on each bar update event (incoming tick)
              /// </summary>
              protected override void OnBarUpdate()
              {
                     [COLOR="Blue"]enterLongStrat1 = false;
      		enterLongStrat2 = false;	[/COLOR]		
      			
                  // Strategy 1
      			if (Bars.BarsSinceSession >=7)
      	        if (Stochastics(7, 14, 3).D[0] >= 30)
                  {
                      enterLongStrat1 = true;
      		//		enterLongStrat2 = false;
      				DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 20 * TickSize, Color.Red);
      				
                  }
      			
      			//Strategy 2
      			if (Bars.BarsSinceSession >=7)
      				
      			if ( Close[0] >= EMA(30)[0])
                  {
                      enterLongStrat2 = true;
      		//		enterLongStrat1 = false; now, then both conditions can never be simultaneously true if you have this
      				DrawTriangleUp("My triangle up" + CurrentBar, true, 0, High[0] + 30 * TickSize, Color.Blue);
      				
                  }
      			
      			if (Bars.BarsSinceSession >=7)
      			if(enterLongStrat2 == true && enterLongStrat1 == true)
      			{    
        				EnterLong(DefaultQuantity, "");
      				
      			}
              }
      
              #region Properties
              [Description("")]
              [GridCategory("Parameters")]
              public int MyInput0
              {
                  get { return myInput0; }
                  set { myInput0 = Math.Max(1, value); }
              }
      
      	
      		
              #endregion
          }
      }
      So far, the code is doing what you coded. You have never reset your bool flags, so once they were set the first time, they were always true. When coding, you have to be aware of what your entities are valued at, and how they will behave.

      I understand that you may be in unfamiliar territory, so I should probably have made a longer explanation of what to do, rather than assume that my terse answers would be enough. I apologize.

      In your particular setup:
      1. You have no exit. If you always intend to exit at EndOfDay, then that is not an issue.
      2. If you want signals to happen only when all conditions are satisfied on the exact same bar, then you have to start on every bar with all conditions being false before they are evaluated. Once again, I have added the necessary code in blue into your code list.

      Comment


        #18
        Dear koganam,

        I have fallowed everything you and others have said I should do to make this work. I guarantee that I fallowed everything you said to the tee and tried all of those different variations to make this work. I have attached the strategy of what I have.Please test it on your computer and tell me if it works on your computer, because it does not work on mine.
        Attached Files

        Comment


          #19
          Originally posted by wallsteetking View Post
          Dear koganam,

          I have fallowed everything you and others have said I should do to make this work. I guarantee that I fallowed everything you said to the tee and tried all of those different variations to make this work. I have attached the strategy of what I have.Please test it on your computer and tell me if it works on your computer, because it does not work on mine.
          Well, wallstreetking, we recently had a fire that wiped out all our stuff. We are trying to see what we can recover, so I am a bit tied up now, but I will look at what you have, and see how we can create a viable skeleton for you. I just cannot give you a time limit, but I will be working on it soon.

          Comment


            #20
            koganam, no problem I am sorry for you property loss I hope that its recoverable. I will check back here in a week or so. take care.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            83 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            47 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            29 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            32 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            66 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X