Using the CALL Instruction to Access Custom Indicators in ProBuilder

11 Oct 2016
0 comment
0 attachment

This example demonstrates how to use the CALL instruction in ProBuilder to access and utilize custom indicators within a trading strategy. The code snippet shows how to call a custom indicator that calculates two different types of moving averages based on provided parameters.

ave1, ave2 = CALL"myIndicator"[50,0,100,1](close)

The code snippet above is a practical application of calling a custom indicator in a trading strategy. Here’s a step-by-step explanation:

  • Custom Indicator Definition: Assume there is a custom indicator named myIndicator which is designed to calculate two averages based on its parameters. The indicator would typically be defined elsewhere in your ProBuilder scripts.
  • Parameters: The indicator myIndicator accepts four parameters. In this example, these parameters are set to calculate two types of averages:
    • p1 and t1 are set to 50 and 0 respectively, which might represent a 50-period simple moving average.
    • p2 and t2 are set to 100 and 1 respectively, which might represent a 100-period exponential moving average.
  • Calling the Indicator: The CALL instruction is used to execute the indicator with specific parameters. The syntax CALL"myIndicator"[50,0,100,1](close) indicates that the indicator is called with the parameters 50, 0, 100, and 1, and it uses the close price data.
  • Storing Results: The results returned by the indicator are stored in the variables ave1 and ave2. These variables receive the calculated averages from the custom indicator, which can then be used in further analysis or conditions within the strategy.

This example illustrates the flexibility of ProBuilder in creating modular, reusable components such as indicators, which can be dynamically called with different parameters in various trading strategies.

Related Post

Check out this related content for more information:

https://www.prorealcode.com/topic/call-instruction/#post-110915

Visit Link
What is a Snippet? A snippet is a small, reusable chunk of code designed to solve specific tasks quickly. Think of it as a shortcut that helps you achieve your coding goals without reinventing the wheel. How to Use: Simply copy the snippet and paste it into your project where needed. Don't forget to tweak it to fit your context. Snippets are not just time-savers; they're also learning tools to help you become a more efficient coder.
Vonasi Master
V-oyaging ON A S-mall I-ncome
Author’s Profile

Comments

Search Snippets

Showing some results...
Sorry, no result found!

Snippets Categories

global
35
indicator
133
strategy
171

Recent Snippets

How to Create a Simple MTF Trend Dashboard with EMA and SMA
indicator
This indicator builds a compact multi-timeframe (MTF) dashboard that shows whether price is trading above or below a [...]
How to Display Per-Bar Volume Accumulation in Real Time (Intrabar Updates)
global
This snippet tracks and displays the current bar’s accumulated volume while the bar is still forming, instead of only [...]
Ticks Counter: Count Tick Updates Per Bar on Tick or Time Charts
global
This snippet counts how many tick updates have occurred for the current bar by incrementing a per-bar counter on each [...]
How to Build a Step-Based Trailing Stop That Moves to Break-Even First
strategy
This snippet implements a step trailing stop that advances in fixed increments once price reaches predefined profit [...]
Utilizing Arrays to Track and Compare Indicator Values Within the Same Bar in ProBuilder
indicator
This ProBuilder code snippet demonstrates how to use arrays to compare the values of an indicator (RSI in this case) [...]
Logo Logo
Loading...