Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

How to filter my signals with another indicator

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

    How to filter my signals with another indicator

    Hi,

    I am using MACD for generating buy and sell calls. now i want to filter my signals with suppertrend indicator.when my suppertrend in UPTREND i don't want to plot RED ARROWS vice versa for DOWNTREND.

    this is my MACD signal generating code:

    if(CrossAbove(dotSeries, BB_UpperBand,1)&&up)

    {
    {
    DrawArrowUp("up"+CurrentBar,false,0,Low[0]+2*TickSize,Color.Green);
    }
    up=false;
    down=true;
    }
    i call my suppertrend indicator in MACD like this:
    if((TSSuperTrend(7, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.618, 7, TradingStudies.NinjaScript.Utility.SuperTrendMode. Adaptive).Trend[0]==true))
    i want to remove my wrong calls please help me how to use this two codes properly.

    Thank You,
    Attached Files

    #2
    Hello,

    I do not have access to these indicators so I cannot test this, but the basic idea should be the same.

    You can add a check for your SuperTrend indicator and then put the checks for the MACD inside that block:

    Code:
    //checks that SuperTrend is True
    if((TSSuperTrend(7, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.618, 7, TradingStudies.NinjaScript.Utility.SuperTrendMode. Adaptive).Trend[0]==true))
    {
       //if the super trend is true, then check the cross above for the MACD
        if(CrossAbove(dotSeries, BB_UpperBand,1)&&up)
    
        {	
            {
                //only would draw this if both proceeding conditions are true
                DrawArrowUp("up"+CurrentBar,false,0,Low[0]+2*TickSize,Color.Green);
            }
        up=false;
        down=true;
        }
    }
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi Matthew,

      Thank You so much for your quick reply,

      i check this code:

      //checks that SuperTrend is True
      if((TSSuperTrend(7, TradingStudies.NinjaScript.Utility.MovingAverageTy pe.HMA, 1.618, 7, TradingStudies.NinjaScript.Utility.SuperTrendMode. Adaptive).Trend[0]==true))
      {
      //if the super trend is true, then check the cross above for the MACD
      if(CrossAbove(dotSeries, BB_UpperBand,1)&&up)

      {
      {
      //only would draw this if both proceeding conditions are true
      DrawArrowUp("up"+CurrentBar,false,0,Low[0]+2*TickSize,Color.Green);
      }
      up=false;
      down=true;

      }
      }
      it's working but we have a small problem. It appears that only a few are seen not all arrows. as per my knowledge
      we are using "&&up" function that's why we miss some Important ARROWS. because "&&up" function for if up is true and the Cross Above() then draw the arrow vice versa for the CrossBelow(). in this case if we remove one GREEN ARROW next RED ARROW also does not come.

      please give me Ticket number . i will send indicators to you through email.

      please help me

      ThankYou,
      Last edited by paruchuriphani; 03-27-2013, 01:35 PM.

      Comment


        #4
        Hello,

        From your description, I think you understand what needs to be done. Please make the changes you feel meet your requirements for your custom script. If you run into any issues or have questions, we're happy to help point you into the right direction, but we cannot help you code every level of this indicator.

        If you need to expand your knowledge of how to program your indicators, I would encourage you to attend one of our premium paid education events in regards to indicator development:



        We do not do any in house custom development services. I know that we've done this for you a few times, but we will not be able to further assist you with your custom development in this manner.

        Thank you for understanding.
        Last edited by NinjaTrader_Matthew; 03-27-2013, 01:46 PM.
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by wzgy0920, 04-20-2024, 06:09 PM
        2 responses
        26 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, 02-22-2024, 01:11 AM
        5 responses
        32 views
        0 likes
        Last Post wzgy0920  
        Started by wzgy0920, Yesterday, 09:53 PM
        2 responses
        49 views
        0 likes
        Last Post wzgy0920  
        Started by Kensonprib, 04-28-2021, 10:11 AM
        5 responses
        191 views
        0 likes
        Last Post Hasadafa  
        Started by GussJ, 03-04-2020, 03:11 PM
        11 responses
        3,230 views
        0 likes
        Last Post xiinteractive  
        Working...
        X