Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pyramide and Kelly-f,Optimal-f and Secure-f

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

    #16
    pedro,

    Please find attached a screen shot.

    I would suggest attending the Automated Strategy Level I webinar to learn more about using the Strategy Wizard.

    Tune in every trading day to learn how to trade futures with the pros. Get expert analysis, actionable insights, and diverse perspectives, all in one place.
    Attached Files
    Adam P.NinjaTrader Customer Service

    Comment


      #17
      Adam,
      Can you tutorial how make this strategy for me see if I understand all?
      Strategy:buy 30% of account AAPL when closes>=the upper Donchian Channel,buy with the remaining money(70%) when the fast SMA crosses above the lower SMA.
      Pedro
      Ps:I don't know when I change EnterLong(3, "Entry1") to EnterLong(7, "Entry2")

      Comment


        #18
        pedro,

        I can show you a couple screen shots but generally we don't do custom development for our customers as it would adversely affect our standard of support due to the time consuming nature of it.

        How do you define the number of shares to purchase? How far are you into making this strategy already?

        It is important to learn the basics here first before you attempt to make something more complicated. It also helps so that we can "speak the same language" with the strategies as my instructions for how to do this may not be understandable to you until you understand the basics.

        I would suggest watching this to get started on strategy development : http://www.youtube.com/watch?v=fVFqw5W8uGI

        Here are two tutorials on using the strategy wizard : http://www.ninjatrader.com/support/h...strategies.htm

        Here are our NinjaScript educational resources : http://www.ninjatrader.com/support/h..._resources.htm
        Adam P.NinjaTrader Customer Service

        Comment


          #19
          Adam,
          I read everything about strategy development process,but I didn't find anything about buy a percentage of the account in set1 and the the remaining of the account in set2.
          I'm sure that you know ho do this,and you will spend only a few minutes to tell me with screen shots.
          I searched for how do this in everywhere,but I didn't find anything.
          I was looking for this a long time.
          Pedro

          Comment


            #20
            pedro,

            The example I gave you is more for setting some contracts based on a 70% / 30% split of some static value but won't factor in account size. For this you would need to program it in NinjaScript.

            Here is an example :

            Code:
            protected override void OnBarUpdate()
            {
            
            double account_value = GetAccountValue(AccountItem.BuyingPower);
            double percentage_to_risk_of_account = 0.1;  //10%
            
            // calculate how many orders you want here
            int totalorderquantity = (int) ( (percentage_to_risk_of_account * account_value) / Close[0]);
            
            if ( CrossAbove(Close, DonchianChannel(period).Upper , 0) )
            {
                EnterLong( ((int) totalorderquantity *0.3), "Entry1");
            }
            
            if( Position.MarketPosition == MarketPosition.Long  && CrossAbove(SMA(fast), SMA(slow),0) )
            {
                EnterLong( ((int) totalorderquantity *0.7), "Entry2");
            }
            
            }
            To be clear here, you will need to learn NinjaScript to understand this better. I would suggest spending some time browsing our forum, as well as learning from our educational resources. If you ask specific questions we are able to answer them, however we typically do not do any custom coding of strategies nor write individual tutorials unless we get a lot of interest in a particular subject.

            NinjaScript support forum : http://www.ninjatrader.com/support/f...splay.php?f=16

            Forum reference samples : http://www.ninjatrader.com/support/f...splay.php?f=30

            Basic programming concepts : http://www.ninjatrader.com/support/h...g_concepts.htm

            Help guide : http://www.ninjatrader.com/support/h..._resources.htm

            Good educational video on NinjaScript : http://www.youtube.com/watch?v=JZpo01eSO9c

            If you need any further assistance programming your strategy here but don't have the time, I would suggest getting in contact with a NinjaScript consultant.

            Last edited by NinjaTrader_AdamP; 08-01-2012, 03:57 PM.
            Adam P.NinjaTrader Customer Service

            Comment


              #21
              Adam,
              I code my startegy and added a exit(SMA 5 crosses below SMA 14),but I couldn't compile because had a error.
              Please tell me where I went wrong!
              Code:
              protected override void Initialize()
                         {
              			Add(DonchianChannel(20));
              			Add(SMA(30));
                                      Add(SMA(50));
              			Add(SMA(5));
                                      Add(SMA(14));
              			
                                     CalculateOnBarClose = true;
                         }
              
                         /// <summary>
                         /// Called on each bar update event (incoming tick)
                         /// </summary>
                      protected override void OnBarUpdate()
                      {
              			double account_value = GetAccountValue(AccountItem.BuyingPower);
                                      double percentage_to_risk_of_account = 0.1;  //10%
              
                                     // calculate how many orders you want here
                                     int totalorderquantity = (int) ( (percentage_to_risk_of_account * account_value) / Close[0]);
              
                                    if ( CrossAbove(Close, DonchianChannel(20).Upper , 0) )
                               {
                                    EnterLong( ((int) totalorderquantity *0.3), "Entry1");
                               }
              
                                    if( Position.MarketPosition == MarketPosition.Long  && CrossAbove(SMA(30), SMA(50),0) )
                               {
                                    EnterLong( ((int) totalorderquantity *0.7), "Entry2");
                               }
              		      if( Position.MarketPosition == MarketPosition.Long  && CrossBelow(SMA(30), SMA(50),0) )
              	         {
              		       ExitLong( ((int) totalorderquantity *1), "");
                               }
                           } 
                     }
              Last edited by pedroivo96; 08-01-2012, 08:14 PM.

              Comment


                #22
                Please try using this OnBarUpdate() below :
                Code:
                protected override void OnBarUpdate()
                        {
                	      double account_value = GetAccountValue(AccountItem.BuyingPower);
                                    double percentage_to_risk_of_account = 0.1;  //10%
                
                                    // calculate how many orders you want here
                                    int totalorderquantity = (int) ( (percentage_to_risk_of_account * account_value) / Close[0]);
                
                                    if (CrossAbove(Close, DonchianChannel(20).Upper, 0))
                                 	   EnterLong(((int)(totalorderquantity * 0.3)), "Entry1");
                                 
                
                                    if(Position.MarketPosition == MarketPosition.Long && CrossAbove(SMA(30),SMA(50), 0))
                                       EnterLong( ((int)(totalorderquantity * 0.7)), "Entry2");
                                 
                	      if(Position.MarketPosition == MarketPosition.Long  && CrossBelow(SMA(30), SMA(50),0))
                	         	 		ExitLong("");
                        }

                Comment


                  #23
                  Adam,
                  I tried to compile the strategy,but had a error.
                  I've print screen.Please compile the strategy to understand the error.
                  Attached Files

                  Comment


                    #24
                    The strategy likely would compile fine, but you have another issue in your scalping strategy noted at the bottom of the editor - NT would always compile all your files, so it would be expected in such a case that you can't make progress compiling the opened file at hand. Please remove or fix the other files's offending code lines and see if it would let you take our changes to your script then.

                    Thanks,

                    Comment


                      #25
                      Bertrand,
                      Now I got!
                      But I was looking for a better exit strategy,so I tought in ATR.
                      The stop loss price it's:if the low < (Last Entry Price - (ATR(20)*2)).
                      How can I do this?
                      Ps:I'm using the scaling strategy.
                      Last edited by pedroivo96; 08-02-2012, 12:02 PM.

                      Comment


                        #26
                        Glad to hear Pedro - you would need to custom calculate a stop price (Position.AvgPrice - ATR) and use SetStopLoss in mode price to set the stop to this value on each bar.

                        Some traders like to take the entry bar's ATR as reference, other adjust on every bar to amend with changing volatility.

                        Comment


                          #27
                          Bertrand,
                          Of course,I prefer the entry bar's ATR as reference.But I don't know the code to calculate this.
                          Summary: exit long positions if the low <=(Last Entry Price - (ATR of the First Entry Price(20)*2).
                          See below to understand better:N = 1.20
                          I also would like to add positions like the turtle rules,if the high >= Last Entry Price + ˝ ATR of the First Entry Price.But I don't know the code to calculate too.
                          Please see the images to understand better.
                          Pedro
                          To understand the images:
                          N = ATR(20)
                          1 Unit = 25% of account
                          55 Day Breakout = Donchian Channel(55) breakout
                          Attached Files
                          Last edited by pedroivo96; 08-03-2012, 11:07 AM.

                          Comment


                            #28
                            Pedro, we can unfortunately not offer coding services to fully create your system - for this a NinjaScript consultant could be of help offering professional script generation -



                            To see how an ATR trailing stop could be constructed you could check out the ATR indicator featured in our user sharing section as a starting point for your own works -

                            Comment


                              #29
                              But can you give me just the code to exit long positions if the low <=(Last Entry Price - (ATR of the First Entry Price(20)*2).
                              I think it is not difficult.
                              Pedro

                              Comment


                                #30
                                Pedro, unfortunately we could not custom code this for you - if you're not a programmer or wishing to expand your skills in this area then a certified NinjaScript consultant could be the route to take to get this professionally coded.

                                Comment

                                Latest Posts

                                Collapse

                                Topics Statistics Last Post
                                Started by argusthome, Yesterday, 10:06 AM
                                0 responses
                                20 views
                                0 likes
                                Last Post argusthome  
                                Started by NabilKhattabi, 03-06-2026, 11:18 AM
                                0 responses
                                18 views
                                0 likes
                                Last Post NabilKhattabi  
                                Started by Deep42, 03-06-2026, 12:28 AM
                                0 responses
                                14 views
                                0 likes
                                Last Post Deep42
                                by Deep42
                                 
                                Started by TheRealMorford, 03-05-2026, 06:15 PM
                                0 responses
                                9 views
                                0 likes
                                Last Post TheRealMorford  
                                Started by Mindset, 02-28-2026, 06:16 AM
                                0 responses
                                40 views
                                0 likes
                                Last Post Mindset
                                by Mindset
                                 
                                Working...
                                X