Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bollinger Bands & Macd

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

    Bollinger Bands & Macd

    Hello,

    I would like to code an indicator like this :

    // Condition set 1
    if (CrossAbove(Close, Bollinger(2, 12).Lower, 1)
    && MACD(12, 26, 9).Avg[1] > 0
    && MACD(12, 26, 9).Diff[1] > 0)
    {
    value = 1 ;
    Alert("MyAlert1", Priority.High, "BB Break Up", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav", 5, Color.Gold, Color.Black);
    DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0], Color.Lime);
    }

    // Condition set 2
    if (CrossBelow(Low, Bollinger(2, 12).Lower, 1)
    && MACD(12, 26, 9).Avg[1] < 0
    && MACD(12, 26, 9).Diff[1] < 0)
    {
    value = -1 ;
    Alert("MyAlert2", Priority.High, "BB Break Dn", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav", 5, Color.Gold, Color.Black);
    DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0], Color.Red);
    }
    }

    I was hoping to find items on the forum, but my research has produced nothing ...

    Could you help me???

    Thanks in advance,

    #2
    4x2win, I'm not aware of one exactly doing what you need, have you into the sharing section already? http://www.ninjatrader-support2.com/...splay.php?f=37

    Your code taken from the wizard should also work if you port it over to an indicator, have tried this?

    Comment


      #3
      Hello Bertrand,

      Thank you for your answer.
      I did not go into the sharing section, because I thought it was reserved for cases of shared indicators ...
      I went to this section in order to see if what I want was there, but unfortunately it's not the case ...

      I tried to copy the code wizzard to create the indicator, but I certainly do not properly ... the compiler rejects the code ...

      It's not easy to code this simple indicator..??..
      I need a result of +1 or -1 or 0
      +1 if the close price cross-over the upper bollinger band, and the macd histogram > 0 and the macd line >0
      -1 if the close price cross under the lower bollinger band and the macd histogram <0 and the macd line <0
      0 in all the other cases...

      My code seems to work as a strategy but I need the indicator in order to use it in a market analyser alerts...

      I have read all the link you send but it's a little bit too hard to understand how to program the indicator...

      What can i do ??

      Thanks in advance,

      Comment


        #4
        4x2win, the best start is working throught the tutorial indicators to get a solid base...then continue to work on converting your code. You can also post your snippets here and we take a look...

        If you don't want to get into this and need this professionally programmed / converted for you, please consider contacting those consultants - http://www.ninjatrader.com/webnew/pa...injaScript.htm

        Comment


          #5
          Originally posted by 4x2win View Post
          Hello,

          I would like to code an indicator like this :

          // Condition set 1
          if (CrossAbove(Close, Bollinger(2, 12).Lower, 1)
          && MACD(12, 26, 9).Avg[1] > 0
          && MACD(12, 26, 9).Diff[1] > 0)
          {
          value = 1 ;
          Alert("MyAlert1", Priority.High, "BB Break Up", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav", 5, Color.Gold, Color.Black);
          DrawArrowUp("My up arrow" + CurrentBar, false, 0, Low[0], Color.Lime);
          }

          // Condition set 2
          if (CrossBelow(Low, Bollinger(2, 12).Lower, 1)
          && MACD(12, 26, 9).Avg[1] < 0
          && MACD(12, 26, 9).Diff[1] < 0)
          {
          value = -1 ;
          Alert("MyAlert2", Priority.High, "BB Break Dn", @"C:\Program Files\NinjaTrader 6.5\sounds\Alert4.wav", 5, Color.Gold, Color.Black);
          DrawArrowDown("My down arrow" + CurrentBar, false, 0, High[0], Color.Red);
          }
          }

          I was hoping to find items on the forum, but my research has produced nothing ...

          Could you help me???

          Thanks in advance,
          Did you intend to say for condition1 to alert you when close crosses ABOVE Bollinger.Upper ?

          Did you intend to say for condition2 to alert you when CLOSE crosses below Bollinger.Lower?

          If so, try the attached file. Place it in a panel other than Panel 1.

          Attached Files
          Last edited by ThatManFromTexas; 08-29-2009, 10:05 AM.

          Comment


            #6
            Thank you very much !!
            That's exactly what I was looking for (sorry for the typos errors) !

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by sjsj2732, 03-23-2026, 04:31 AM
            0 responses
            69 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            312 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            305 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            146 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            105 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X