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 NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        65 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        139 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        75 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        50 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X