Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD Diff Based Entry and Exit

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

    MACD Diff Based Entry and Exit

    Hello,

    One of my requirements for entry that I want is for the MACD Diff to be higher than the previous candlesticks close value. (Showing an increase in momentum) I need this to work for when the MACD Difference was previously declining and has now started to reverse trend.

    Also, for my exit strategy I need the value of the MACD Diff high since entry to have decreased by 20% for my exit to be filled.

    Lastly, how do I make sure that there is only one order entry sent per requirements matched. For example, when all my requirements are matched I want there to be one order entry sent out until my requirements are no longer matched and then the strategy could look for another possible entry.

    Thank you so much for your time and help!

    #2
    Hello jabbhc,

    The code for the MACD Diff being higher than the previous close would appear as:
    Code:
    if (CurrentBar > 1 && MACD(12, 26, 9).Diff[0] > Close[1])
    You can check if the value of the Diff plot from 1 bar ago is less than 2 bars ago
    MACD(12, 26, 9).Diff[1] < MACD(12, 26, 9).Diff[0]

    Similarly you can compare the plot from 0 bars ago to be greater than 1 bar go.

    You find 20% of a value by multiplying it by .2.

    Print(MACD(12, 26, 9).Diff[0] * .2);

    The EntriesPerDirection you can set to 1, so once a position is taken new orders are ignored.
    https://ninjatrader.com/support/help...rdirection.htm

    If you have not already watched the Strategy Builder 301 video, I recommend this as a starting point.
    Below is a link to forum post with helpful information about getting started with NinjaScript.
    https://ninjatrader.com/support/foru...040#post786040
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ntbone, Yesterday, 10:31 PM
    2 responses
    14 views
    0 likes
    Last Post ntbone
    by ntbone
     
    Started by 7robert, Yesterday, 11:38 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_ChrisSch  
    Started by dpolyakov, Yesterday, 09:58 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Jason  
    Started by Rainmakersg, Today, 12:34 AM
    0 responses
    5 views
    0 likes
    Last Post Rainmakersg  
    Started by Bidder, Yesterday, 09:07 PM
    1 response
    12 views
    0 likes
    Last Post NinjaTrader_Jason  
    Working...
    X