Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BrainTrend for NT

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

    BrainTrend for NT

    Port of an MT4 indicator posted by Elliot Wave in the eASCTrend thread.

    BrainTrend1 is working, have not tested it much but it looks to give pretty good results.

    BrainTrend2 is ported and compiles but is not working currently, I have no time to debug it now but I figured I would post it as is in case anyone else wants to take a look at it. There is a note in the code about the section I think may be causing problems.

    I have posted them in .cs format in the zip file with the original MT4 indicators. My NT is throwing an error upon trying to export them so perhaps someone else can package them up for those who need it.

    Enjoy..
    Attached Files

    #2
    Thanks for posting those sefstrat, what error do you get exporting them regularly?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you very much.

      Comment


        #4
        Here is an updated version with fixed BrainTrend2. However I am not sure that BT2 is coded correctly, it works now but is too aggressive and does not look like it is supposed to.

        I am fairly certain it was ported correctly so I think the problem is with the mql script. I figured I would post it anyhow in case anyone else wants to attempt to fix it. It could be useful as is if you want to momentum scalp with really tight stops.

        No problems with BrainTrend1, I used it today, works great.

        Oh yeah, it is properly packaged this time also
        Attached Files

        Comment


          #5
          Thanks for posting the update sefstrat!
          BertrandNinjaTrader Customer Service

          Comment


            #6
            Thanks sefstrat.

            Comment


              #7
              BrainTrend Strategy?

              First, I want to thank sefstrat.

              Second, my question is regarding why the indicator does not show up in the Strategy Wizard. My first inclination was to take notice of the fact there is no Ninja generated code at the bottom. So it shows up on the chart, but is not accessible via the Strategy wizard.

              My guess is that I will just have to access the plots manually and trigger buy/sell orders via this approach.

              If anyone has had any success auto trading with this, please share. I will do the same.


              thank you,

              Comment


                #8
                Hmm, it shows up fine in my strategy even without the generated code, although I do not use strategy wizard so that could be the issue. You might try opening the indicator in the NT editor and compiling it there, perhaps that would generate the code for you?

                I autotraded with it yesterday and today, did very well today but then again the EURUSD was trending like crazy today so any indicators would have done well

                I would not use it as my only indicator in a strategy, trend detectors like this always work best with other indicators to filter out some of the signals which are unlikely to go anywhere. I use a combination of several momentum based indicators for this purpose.

                Originally posted by r2kTrader View Post
                First, I want to thank sefstrat.

                Second, my question is regarding why the indicator does not show up in the Strategy Wizard. My first inclination was to take notice of the fact there is no Ninja generated code at the bottom. So it shows up on the chart, but is not accessible via the Strategy wizard.

                My guess is that I will just have to access the plots manually and trigger buy/sell orders via this approach.

                If anyone has had any success auto trading with this, please share. I will do the same.


                thank you,

                Comment


                  #9
                  Brain Trade not showing in Strategy Condition Builder

                  Sefstrat,

                  What took you so long to reply?

                  I did try to compile the code/indicator using NT to see if it would generate the said code, no luck though. Tried all that before asking for help.

                  1. I am using the 6.5 latest version (8 or whatever I believe).

                  2. The signal shows up fine when I use it from the chart.

                  3. When I try to use the Condition Builder with right mouse click from withing strategy editor, or from within the wizard, the indicator does not appear under the list of indicators. The only thing I can see that is different is that the indicator (brain trade) does not have the auto generated code at the bottom. Interestingly, it appears the properties are in the initialize() portion of the script (I think, more of a kludger, not a programmer).

                  If you have any suggestions, I am all ears. I played with the indicator today and I think I can get similar results with a simple MA crossover with some filters. At least performance wise. So I would like to backtest and do real comparisons. Also want to play with volume as a filter, etc.

                  I can't say thanks enough to you for porting. If there is anything I can do to help, let me know.

                  One last thing. Could you provide code snippet from strategy you used to have it fire the trade? I don't need all, just something to play with and see where I can take it. Maybe something to fire a long trade considering the markets are so bullish these days and trending higher!
                  Last edited by r2kTrader; 02-19-2009, 05:04 PM. Reason: Wanted to add additional question.

                  Comment


                    #10
                    Here is a snippet from the strategy I am using now, I used the BrainTrend signal as the entry signal rather than a cross above the BT stop line since sometimes the price can cross temporarily and the signal will not be fired (depends on measures of ATR/Stochastics that the indicator uses).

                    You are right though, you can probably make a simple MA xover system beat 90% of systems based on fancy indicators if you know what you are doing. The advantage of this indicator however is that it automatically adjusts itself based on the current volatility and momentum.

                    It is very similar to the SuperTrend indicator, except that SuperTrend only accounts for volatility and not momentum. BrainTrend hugs the bars tighter during times of high momentum, that implies that it requires a slightly different strategy than an indicator like SuperTrend because it may generate a false opposing signal on a slight retracement after huge momentum burst. Of course that is a bad thing if your strategy does not account for it, but if you are willing to do a bit of work in strategy development you can find ways to exploit this behavior to your advantage

                    (Note that I changed the BrainTrend settings from their defaults in the initialize method, you will probably want to tweak them for your instrument/timeframe)

                    Code:
                        public class BrainTrendStrategy : Strategy
                        {
                            private BrainTrendNT _brainTrend;
                            private bool _useTrailStop = true;
                            private int _stopAmount = 65;
                            private int _profitTarget = 50;
                    
                            protected override void Initialize()
                            {
                                _brainTrend = new BrainTrendNT();
                                _brainTrend.StochasticPeriod = 9;
                                _brainTrend.StochMax = 53;
                                _brainTrend.StochMin = 31;
                                Add(_brainTrend);
                               
                                CalculateOnBarClose = true;
                            }    
                    
                            [Description("Trail or Normal Stop?"), Category("Parameters")]
                            public bool UseTrailStop { get { return _useTrailStop; } set { _useTrailStop = value; } }
                        
                            [Description("Stop Amount in Ticks (0 to disable)"), Category("Parameters")]
                            public int StopAmount { get { return _stopAmount; } set { _stopAmount = value; } }
                        
                            [Description("Profit Target in Ticks (0 to disable)"), Category("Parameters")]
                            public int ProfitTarget { get { return _profitTarget; } set { _profitTarget = value; } }
                    
                            protected override void OnBarUpdate()
                            {
                                if (_brainTrend.BuySignal.ContainsValue(0) || _brainTrend.BuySignal.ContainsValue(1))
                                {                
                                    EnterLong("brainTrend up");
                                    adjustLimits("brainTrend up");
                                }
                                if (_brainTrend.SellSignal.ContainsValue(0) || _brainTrend.SellSignal.ContainsValue(1))
                                {                
                                    EnterShort("brainTrend down");
                                    adjustLimits("brainTrend down");
                                }    
                            }
                            
                            private void adjustLimits(string signalName)
                            {
                                    if (_stopAmount > 0)
                                    {
                                        if (!_useTrailStop) SetStopLoss(signalName, CalculationMode.Ticks, _stopAmount, false);
                                        else                SetTrailStop(signalName, CalculationMode.Ticks, _stopAmount, false);
                                    }
                                    
                                    if (_profitTarget > 0)     SetProfitTarget(signalName, CalculationMode.Ticks, _profitTarget);
                            }
                        }

                    Comment


                      #11
                      Sefstrat,

                      you're the best. Let me know if there is anything I can do to help you in return. If you need testing or anything, let me know.

                      will check this out.

                      Also, your reply time is extremely unreasonable. It took you over 1 hour! lol. Nice turn around, thanks again !!



                      R2Ktrader.
                      Originally posted by sefstrat View Post
                      Here is a snippet from the strategy I am using now, I used the BrainTrend signal as the entry signal rather than a cross above the BT stop line since sometimes the price can cross temporarily and the signal will not be fired (depends on measures of ATR/Stochastics that the indicator uses).

                      You are right though, you can probably make a simple MA xover system beat 90% of systems based on fancy indicators if you know what you are doing. The advantage of this indicator however is that it automatically adjusts itself based on the current volatility and momentum.

                      It is very similar to the SuperTrend indicator, except that SuperTrend only accounts for volatility and not momentum. BrainTrend hugs the bars tighter during times of high momentum, that implies that it requires a slightly different strategy than an indicator like SuperTrend because it may generate a false opposing signal on a slight retracement after huge momentum burst. Of course that is a bad thing if your strategy does not account for it, but if you are willing to do a bit of work in strategy development you can find ways to exploit this behavior to your advantage

                      (Note that I changed the BrainTrend settings from their defaults in the initialize method, you will probably want to tweak them for your instrument/timeframe)

                      Code:
                          public class BrainTrendStrategy : Strategy
                          {
                              private BrainTrendNT _brainTrend;
                              private bool _useTrailStop = true;
                              private int _stopAmount = 65;
                              private int _profitTarget = 50;
                      
                              protected override void Initialize()
                              {
                                  _brainTrend = new BrainTrendNT();
                                  _brainTrend.StochasticPeriod = 9;
                                  _brainTrend.StochMax = 53;
                                  _brainTrend.StochMin = 31;
                                  Add(_brainTrend);
                                 
                                  CalculateOnBarClose = true;
                              }    
                      
                              [Description("Trail or Normal Stop?"), Category("Parameters")]
                              public bool UseTrailStop { get { return _useTrailStop; } set { _useTrailStop = value; } }
                          
                              [Description("Stop Amount in Ticks (0 to disable)"), Category("Parameters")]
                              public int StopAmount { get { return _stopAmount; } set { _stopAmount = value; } }
                          
                              [Description("Profit Target in Ticks (0 to disable)"), Category("Parameters")]
                              public int ProfitTarget { get { return _profitTarget; } set { _profitTarget = value; } }
                      
                              protected override void OnBarUpdate()
                              {
                                  if (_brainTrend.BuySignal.ContainsValue(0) || _brainTrend.BuySignal.ContainsValue(1))
                                  {                
                                      EnterLong("brainTrend up");
                                      adjustLimits("brainTrend up");
                                  }
                                  if (_brainTrend.SellSignal.ContainsValue(0) || _brainTrend.SellSignal.ContainsValue(1))
                                  {                
                                      EnterShort("brainTrend down");
                                      adjustLimits("brainTrend down");
                                  }    
                              }
                              
                              private void adjustLimits(string signalName)
                              {
                                      if (_stopAmount > 0)
                                      {
                                          if (!_useTrailStop) SetStopLoss(signalName, CalculationMode.Ticks, _stopAmount, false);
                                          else                SetTrailStop(signalName, CalculationMode.Ticks, _stopAmount, false);
                                      }
                                      
                                      if (_profitTarget > 0)     SetProfitTarget(signalName, CalculationMode.Ticks, _profitTarget);
                              }
                          }

                      Comment


                        #12
                        Originally posted by sefstrat View Post
                        It is very similar to the SuperTrend indicator, except that SuperTrend only accounts for volatility and not momentum...
                        SuperTrend also has a multiplier parameter for the ATR. Perhaps BrainTrend could be improved by this.

                        Comment


                          #13
                          Good call, actually it already had multipliers, I forgot to add them to the parameters list, oops.

                          One multiplier is multiplied by the ATR of the current bar and determines how much tolerance there is for the price crossing the stop line.

                          The other is multiplied by the ATR of prior bars and is used to determine the distance of the stopline, the same way SuperTrend multiplier works.

                          You can also tweak the stopline distance and how sensitive it is to momentum changes by modifying the stochastic max/min parameters.

                          Here is the updated code.

                          Originally posted by Elliott Wave View Post
                          SuperTrend also has a multiplier parameter for the ATR. Perhaps BrainTrend could be improved by this.
                          Attached Files

                          Comment


                            #14
                            Braintrend

                            This is an interesting indicator...can you give us a thumbnail sketch as to how to use it...ie the entry sigs a re clear but the stop sigs...? are they intended as a stop out on violation of the stop levels ...if so the indicator continues for some time after a price violation ...how are the stop levels used...?

                            Comment


                              #15
                              Originally posted by pgabriel View Post
                              This is an interesting indicator...can you give us a thumbnail sketch as to how to use it...ie the entry sigs a re clear but the stop sigs...? are they intended as a stop out on violation of the stop levels ...if so the indicator continues for some time after a price violation ...how are the stop levels used...?

                              Here is a link to the BrainTrading manual, perhaps it will help.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Tim-c, Today, 02:10 PM
                              1 response
                              7 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by Taddypole, Today, 02:47 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post Taddypole  
                              Started by chbruno, 04-24-2024, 04:10 PM
                              4 responses
                              50 views
                              0 likes
                              Last Post chbruno
                              by chbruno
                               
                              Started by TraderG23, 12-08-2023, 07:56 AM
                              10 responses
                              401 views
                              1 like
                              Last Post beobast
                              by beobast
                               
                              Started by lorem, Yesterday, 09:18 AM
                              5 responses
                              25 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Working...
                              X