In our introduction to the composite plug-in, we said that we can use a .Net script to create a composite. In the following post, we will show you how. - Update a composite then click on Next. - Click on Script button to open the .Net formula editor. - Click on the editor then type CONTROL+SPACE to display the available classes/functions. - The main class here is "Functions". Using this class: - You can get composites created using the vector-based language (GetVariable method which returns an Array of double) - Get all available dates - Set the close, open, high, low, volume and open-interest fields of the composite. Here is a simple example that gets the composite of the vector-based formula and adds one to each element. Vector-based formula: composite = sma(20); .Net Script: double[] comp = Functions.GetVariable("composite"); for(int i=0;i comp[i] = comp[i] + 1; } Functions.SetCompositeData(comp);
|
![]() |