Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategies and chart indicators / AddChartIndcator

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

    Strategies and chart indicators / AddChartIndcator

    Hi,


    I have an indicator I would like to use in a strategy. However, I only seem to be able to access its values when it has been added to a chart, and not when I programmatically create an instance of it. What the indicator does is paint the background of the chart. In my own custom indicator, I can loop through the indicators on a chart to find the 3rd-party indicator and successfully call getBackColor() to detect the background color of the chart. If I create an instance of the same indicator in my code, the background color always returns #00FFFFFF. So a couple of questions -


    Is it expected that an indicator that paints the background color of a chart only have value for getBackColor() if it is actually on a chart and not just being newed up programmatically?


    It's possible to add an indicator to a chart from a strategy using AddChartIndicator(VOL()). Is it possible then to turn around and find that indicator on the chart and access its properties and methods?


    Is there anything special I should do when I create an instance of the 3rd-party indicator such that getBackColor() will return the same values that a "live" instance of the indicator would from a chart?


    Thanks,


    Gordon​

    #2
    Hi Gordon, thanks for writing in. For scripts to access data from a hosted script the hosted script must add a Plot or a public Series object and fill it with values. See here for an example public bool series:



    Kind regards,
    -ChrisL

    Comment


      #3
      Hi Chris,

      Thanks for your response. I tried working with an indicator in a strategy using the AddChartIndicator(), but while the call was successful, the indicator did not appear on the chart. It's usual plot data did not appear. Is that expected behavior?

      Regards,

      Gordon

      Comment


        #4
        Hi Gordon, thanks for the follow up. Please check the Log tab of the Control Center for any errors. Any indicator passed into AddChartIndicator should show up on the chart.

        Kind regards,
        -ChrisL

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        62 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        134 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