Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

indicator on different values

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

    indicator on different values

    If one has Calculate.OnEachTick but wants to get values such as the Max value in a bar of the MACD histogram, (set to 1min charts so 1min bars), how would they achieve this in the script?

    #2
    Hello Boonfly8,

    Thanks for your post.

    If you are looking for previous values you can just use the barsago of the MACd.diff plot

    If you are looking for the maximum movement during the current bar, the currently forming bar (and diff plot) may well change during the bar formation and the diff plot may grow larger or smaller depending on the relationship of the MACD and MACD.avg lines. If you are wanting to find the maximum movement of the plot during the current bar formation then you can accomplish this by saving the current diff value to a variable and then comparing the next ticks diff value to the variable and save if larger. At the end of the bar the maximum would then be in the variable. You would use if (IsFirstTickOfBar) as the start and end point.

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      Hello Boonfly8,

      Thanks for your post.

      If you are looking for previous values you can just use the barsago of the MACd.diff plot

      If you are looking for the maximum movement during the current bar, the currently forming bar (and diff plot) may well change during the bar formation and the diff plot may grow larger or smaller depending on the relationship of the MACD and MACD.avg lines. If you are wanting to find the maximum movement of the plot during the current bar formation then you can accomplish this by saving the current diff value to a variable and then comparing the next ticks diff value to the variable and save if larger. At the end of the bar the maximum would then be in the variable. You would use if (IsFirstTickOfBar) as the start and end point.
      Hi Paul, thx for your note. I thought of simply using MACD.Diff[BarsAgo] but in this case if the strategy is set to Calculate.OnEachTick, the bars ago are tick changes where I need the maximum value of the bar of the histogram completed from my 1min chart.

      Comment


        #4
        Hello Boonfly8,

        Thanks for your reply.

        Just to be sure we are saying the same thing, MACD.Diff[0] will provide the current (tick) value of the MACD diff plot and may change on each tick until the bar closes at which point the diff value will be fixed and would be seen as historical. MACD.Diff[1] would be the prior bar completed and unchanging diff value, MACD.Diff[2] would be the completed bar before that, etc. etc.

        If you need the maximum that the diff plot was during the forming bar then you can accomplish this by saving the current diff value to a variable and then comparing the next ticks diff value to the variable and save if larger. At the end of the bar the maximum would then be in the variable. You would use if (IsFirstTickOfBar) as the start and end point.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        109 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        59 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        37 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        40 views
        0 likes
        Last Post TheRealMorford  
        Started by Mindset, 02-28-2026, 06:16 AM
        0 responses
        77 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X