Click here to Login





                                                   Function Call

  0

0
dare2
2012-09-11 23:11:40


How do I go about calling up a function for use in a new function I am creating? I am stymied. The following compiles okay but when I try to add it to a chart I get
an error in formula message, specifically the AC = AO-SMA(AO,5) portion.

cFunctions.SetForwardAndBackwardBars (34, 0);
result = cFunctions.CompileFormula ("AC = AO - SMA(AO, 5);").GetVectorDouble ("AC");

I have successfully created and implemented AO, so it is in my functions file.

Thank you,
Darrell Allen



QuantShare
2012-09-12 10:50:18

  0

Best Answer
There is an error in the formula specified in "CompileFormula". The variable "AO" is unknown.

You should put instead:

cFunctions.SetForwardAndBackwardBars (34, 0);
result = cFunctions.CompileFormula ("a = (high + low) / 2; ao = sma(a, 5) - sma(a, 34); AC = ao - SMA(ao, 5);").GetVectorDouble ("AC");

You can also use the "TA" class instead of "CompileFormula"

VectorD a = (cFunctions.High + cFunctions.Low) / 2;
VectorD ao = TA.Sma(a, 5) - TA.Sma(a, 34);
result = ao - TA.Sma(ao, 5);




dare2
2012-09-12 14:00:12

  0

Fantastic. Your customer support is great!

Thank you,
Darrell



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Monthly individual stocks put and call volume
Put minus Call Options Volume - Market Indicator
Swing Point Function (SP)
Put Call Volume Comparison Indicator
Covered Call Strategy Indices - Dow DJIA and NASDAQ-100 Index

How-to Lessons
How to create trading rules based on Put and Call volume data
How to plot arrows below/above candlesticks on a chart
Difference between the watchlist and the screener tools
How to plot two different time frames in the same chart
How to set order type of a trading system programmatically

Related Forum Threads
Calling a Function from another Function
Interpretation of " DRAWDOWNEQ" function
TimeframeApply function
Question on Swing Point function sp()
Comp Function in Trading System Rules

Blog Posts
The 'inside period' function
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
How to create market indicators using the composite function - Pa...
How to use date components in your trading rules









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.