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.
    Paul H.NinjaTrader Customer Service

    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.
        Paul H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by habeebft, Today, 07:27 AM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_ChristopherS  
        Started by AveryFlynn, Today, 04:57 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by Max238, Today, 01:28 AM
        4 responses
        37 views
        0 likes
        Last Post Max238
        by Max238
         
        Started by r68cervera, Today, 05:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by geddyisodin, Today, 05:20 AM
        1 response
        14 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X