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 unnecessary macd cross?

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

    How to filter unnecessary macd cross?

    Dear Team,

    I'm using jurbolbbmacd https://ninjatraderecosystem.com/use.../jurbolbbmacd/ as an important indicator.
    One issue bothers me is that,while the trend is obviously up,and the market is obviously bullish,the jurbolddmacd still will cross below is uper line or lower line,as you can check in the image,this will cause wrong short.

    Actually I used supertrend as main indicator before,but the issue is that once the market is not very bullish,supertrend will cause a lot of wrong long.

    Any idea that how I can filter the unnecessary macd crosses?

    Thank you very much!
    Attached Files

    #2
    Hello williamzz,

    Thanks for your post.

    In order to filter signals, you will need to be able to logically define what a specific signal is that should be filtered. After you have logically defined it, code must then be written based off of that logic to filter out the signal.

    For example, you could check other market conditions that tell you if the market is bullish or bearish and if those conditions are true, and you do want to filter signals, you could then ignore the signal by also checking if the other conditions are allowing this signal.

    If you are new to NinjaScript, I recommend using the Strategy Builder to generate syntax based off of logical conditions. From the Builder, you could also set bools for your other conditions. For example, if Close[0] > Open[0], then you can set a "bullish" bool to true and then you could check if "bullish" is true and your cross has occurred, and the signals will be filtered so they only occur when your bools are true and the cross is seen.

    I have included some Strategy Builder resources below.

    Strategy Builder 301 - https://www.youtube.com/watch?v=_KQF2Sv27oE

    Conditions examples - https://ninjatrader.com/support/help...on_builder.htm

    Actions examples - https://ninjatrader.com/support/help...us/actions.htm

    Please let us know if we can be of further assistance.
    JimNinjaTrader Customer Service

    Comment


      #3
      Williamzz,

      how did you go with this.. i might be able to help you. the attached is the condition when the MACD is above the 0 lines it will only take longs and when below take shorts. there is also another way of doing this which is using a moving average to filter is the same way. which is attached also.

      see how you go mate

      regards

      Simon Thompson
      Click image for larger version

Name:	2019-10-12_165700.png
Views:	344
Size:	159.9 KB
ID:	1074186Click image for larger version

Name:	2019-10-12_170126.png
Views:	303
Size:	158.9 KB
ID:	1074187

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by pechtri, 06-22-2023, 02:31 AM
      6 responses
      116 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by birdog, 01-25-2023, 08:10 PM
      2 responses
      158 views
      1 like
      Last Post RickAce
      by RickAce
       
      Started by stafe, 04-15-2024, 08:34 PM
      12 responses
      59 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by benmarkal, Today, 12:52 PM
      0 responses
      5 views
      0 likes
      Last Post benmarkal  
      Started by Tim-c, Today, 03:54 AM
      3 responses
      13 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X