Click here to Login





                                                   Compiler crashes

  0

0
Obuli Govindaraju
2011-11-20 22:55:19


I am writing a Function under Create function and with the following code, the compiler simply hangs and I have to kill the program through task manager.

----------------------------------------------------------------
int i,j;

int cycle_StartDateYear = 1929;
int cycle_StartDateMonth = 1;
int cycle_StartDateDay = 1;
int cycle_DurationYears = 18;

VectorDate barDate = cFunctions.Date;

i=0;

while(true)
{
if ( barDate[i].Year == cycle_StartDateYear )
{
if (i>=result.Length) break;

for(j=0;j<18;j++)
{
result[i] = j;
i++;
}

}
}



QuantShare
2011-11-21 02:32:34

  0

Best Answer
This function will loop infinitely.

The "year" condition will always return "false" because "i" will always be equal to 0 (The update is done after the condition check which is wrong)
barDate[i].Year == cycle_StartDateYear



Obuli Govindaraju
2011-11-21 08:28:16

  0

I understand the flaw in Logic, but what I dont understand is that why should the editor crash?

Shouldn't my logic flaw be obvious when I don't see the expected results?

I did not do anything wrong with respect to syntax right?



QuantShare
2011-11-21 09:07:42

  0

Scripts created using "Create function" tool are executed in the main thread (Unlike others).

A function that loops infinitely will make the application unresponsive and this will ultimately crash it.



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
Ratio of Equal-weighted to Market capitalization-weighted S&P 500...
Large price and volume gain after consolidation
Index Investment Data for U.S. Futures Markets
Coefficient of Determination - R Squared - Time-Series Prediction
Accumulation Swing Index (To measure long term trends)

How-to Lessons
How to automatically arrange charts?
How to calculate the average of a time series using the money man...
How to create a moving average of an indicator
How to plot the relative performance of several stocks/indices
How to import trades into a portfolio

Related Forum Threads
Quantshare v1.6.8 crashes under 64 bit Vista
What version of .Net does QS's C# compiler use?
Custom Multi-Dimensional Fitness Formula (CMDFF) for Optimizer
How to get the last day of the month in C#
AMM scripting - error and some questions

Blog Posts
Custom Indicator: Accumulation Distribution Line
How to create your own technical analysis indicators
Backtesting Your Trading Systems: Symbol Segmentation
Download historical EOD data for the stock, futures, ETF and Fore...
Trading System: Buy stocks with the highest Sharpe ratio









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.