Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Swing Low on Cht?

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

    Swing Low on Cht?

    What's the correct code to use for putting in a swing low indicator in the strategy script so that those are drawn on a price chart?

    I've tried "AddChartIndicator ( Swing (5).SwingLow [0] );" and "AddChartIndicator ( Swing (5).SwingLowBar (0, 1, 10) );" but keep getting compile error messages (yes, these are going inside "State.DataLoaded").


    #2
    Hello spottysallrite,

    For a strategy to add an indicator to the chart you would use AddChartIndicator. The indicator will display the swing low you just need to add the base indicator. AddChartIndicator(Swing(5));

    Comment


      #3
      Ok, I used "Draw.Text()" to draw on the chart the values produced by "Lows[0] [Math.Max (0,
      Swing (5).SwingLowBar (0, 1, 10) ) ];​". However, these aren't the same values as drawn on the chart by "AddChartIndicator ( Swing (5) ); ". Shouldn't these produce the same values?

      Comment


        #4
        Hello spottysallrite,

        Are you using a large enough lookback period to get at least one instance? The code you provided uses either the low of the current bar or the swing low bar depending on which has a higher value. If you want to print just a swing you need to first make sure your lookback period got at least 1 swing and then print the value.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        134 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        67 views
        0 likes
        Last Post PaulMohn  
        Working...
        X