Click here to Login




Using the .Net Language to Create Composites

Updated on 2010-10-22





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);








no comments (Log in)

Intermediate Lessons

Advanced Lessons

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.