Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Exposing variable to another indicator

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

    Exposing variable to another indicator

    Hi,

    I have an indicator which works on Calculate.OnBarClose. Essentially it counts bars when a condition (Close[0] <= Low[2]) is true and it almost always uses the close as part of that condition except for the final count, where either the open or the close can be used to fulfil that condition. I did explore IsFirstTickOfBar in the help guide but that only works in Calculate.OnPriceChange or Calculate.OnEachTick.

    Seeing that it wasn't workable, would the following alternative work?

    On the second last count, let's say the count is 12, can I expose this variable to another script/indicator which performs calculations on Calculate.OnPriceChange, so that the new indicator can pull data from the original indicator at the open of the next bar? This should pass on the data that the count is already on a 12 count on the previous bar at the open. At the same time, it can also determine whether the open of the current bar is fulfils the 13th count.

    Would this logic work? Have I missed anything? How would I expose the 12th count if it is workable?

    Regards

    Kay Wai

    #2
    Hi kaywai, thanks for posting. The support team will not be able to verify if your custom scripts will work or not. The best way to verify is something is working is to use the Print() method to print out data from the script. This will let you print out all of the variables and timestamps coming from the script to confirm if you are getting the expected results or not.

    Kind regards,
    -ChrisL

    Comment


      #3
      Hi ChrisL,

      Thanks for you reply. How would I expose a variable from an indicator?

      Regards
      Kay Wai

      Comment


        #4
        Hi Kay Wai, You can make a public int variable in the Indicator class. This page has some examples:

        https://www.geeksforgeeks.org/c-shar...-of-variables/ (publicly available)

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        627 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        359 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        105 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        562 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        568 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X