Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

MACD diff

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

    MACD diff

    I am trying to automate a bot using MACD, but i cannot figure out how to use the diff. Im trying to make it sell if the Macd Diff is less than -0.5 and make it buy when its greater than 0.5 , but i cannot figurs out the code. I tried doing the green line - red line wich should give the same value as the macd diff but did not work. What shall i do?

    // Set 1
    if ((CrossAbove(MACD1.Default, MACD1.Avg, 1))
    && ((MACD1.Default-MACD1.Avg) >= MacdVol)
    && (Times[0][1].TimeOfDay >= StartTime.TimeOfDay)
    && (Times[0][1].TimeOfDay <= EndTime.TimeOfDay))
    {
    EnterLong(Convert.ToInt32(Lots), "");
    }

    // Set 2
    if ((CrossBelow(MACD1.Default, MACD1.Avg, 1))
    && ((MACD1.Default-MACD1.Avg) <= MacdVol*(-1))
    && (Times[0][1].TimeOfDay >= StartTime.TimeOfDay)
    && (Times[0][1].TimeOfDay <= EndTime.TimeOfDay))​

    #2
    use the drop-down putton "value plot". there you can choose the diff.

    if (MACD1.Diff[0] > MacdLong)
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }

    // Set 2
    if (MACD1.Diff[0] < MacdShort)
    {
    EnterShort(Convert.ToInt32(DefaultQuantity), "");
    }​
    Last edited by sane1111; 09-14-2022, 07:37 AM.

    Comment


      #3
      Hello ae72.,

      Thank you for your post.

      As sane1111 mentioned, you can use the dropdown menu to select which plot value you would like to use in your condition. I made a short video that demonstrates what it would look like to set up a condition with the MACD Diff plot:

      World's leading screen capture + recorder from Snagit + Screencast by Techsmith. Capture, edit and share professional-quality content seamlessly.


      This is also similar to the condition example in the help guide for How to compare plot values of multi-plot indicators:



      The only difference is on the right side of the condition, you are not comparing to another plot, but instead comparing to a numeric value.

      Please let us know if we may be of further assistance.

      Comment


        #4
        Thank you, It resolved my issues.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        631 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        364 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        566 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X