Two Questions

Questions directed to our Support Team. Responses can be expected within 24 hours.

Two Questions

Postby Kasmodean » Thu Jun 13, 2013 8:29 am

Hi,

I recently started using Strataseach and I have two questions:

Starting yesterday, when ever I try to view a detailed analysis I get the following error that causes Stratasearch to lock up and need to be closed.
"Chart object could not be instantiated. Unable to open chart." How can I fix this?

Also, I was trying to make a custom formula and entered the line below:
"if(ref(dayofweek(),-x) = 1," but I keep getting the following message (acutally, it is doing it to all my if statement.)
"Invalid variable name if(ref(dayofweek(),-x). Variable names cannot contain special characters or spaces."

Do I Just have to do something like this?
y = ref(dayofweek(),-x)
if(y=1,
Kasmodean
 
Posts: 3
Joined: Wed Jun 12, 2013 9:33 pm

Re: Two Questions

Postby Overload » Thu Jun 13, 2013 6:34 pm

For your first question, it sounds like the chart module became unregistered, so you'll need to register it. You can do that either by reinstalling StrataSearch (which won't affect your data), or by following these steps:

1) Close StrataSearch, if it is open.

2) Use Windows Explorer to locate the StrataSearch program directory. this is usually:

c:\Program Files\StrataSearch Version 4.5\
or
c:\Program Files (x86)\StrataSearch Version 4.5\

3) In the above directory, locate the program RegisterStrataSearch.exe and double-click to run it. It will give you a prompt when it has completed, and you may run it multiple times without problem if you believe it may not have run.

4) Restart StrataSearch and try opening the Detailed Analysis again.

As for the second question, sorry but I'd probably need to see your entire Custom Formula Script to help identify the error. Sometimes it can be related to the previous line, such as missing a semicolon (;) to end the previous statement.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: Two Questions

Postby Kasmodean » Thu Jun 13, 2013 7:28 pm

Thanks for answer 1. Works again. AS for the code this is what I have:

Formula is trying to count the number of times a weekly goal is hit before a stop. I have it conservatively coded like this because if the stop is hit is stops since I don't know the order of highs or lows in the data.

//Formula: Weekly Percent Gain
DaysBack = parameter("Days");
StopLost = parameter("StopLost");
StopGain = parameter("StopGain");

Active=0;
Count=0;
WeekOpen=0;
x = DaysBack;
while(x > 0)
{
if(ref(dayofweek(),-x) = 1,
Active = 1;
WeekOpen = ref(open,-x);
if(ref(low,-x) <= WeekOpen * (1 - (StopLost/100)),
Active = 0;
,);
if(ref(high,-x) >= WeekOpen * (1 + (StopGain/100)),
Count = Count + 1;
Active = 0;
,);
,
if(active = 1,
if(ref(low,-x) <= WeekOpen * (1 - (StopLost/100)),
Active = 0;
,);
if(ref(high,-x) >= WeekOpen * (1 + (StopGain/100)),
Count = Count + 1;
Active = 0;
,);

,);
);
};
WeeklyPG = Count;
Kasmodean
 
Posts: 3
Joined: Wed Jun 12, 2013 9:33 pm

Re: Two Questions

Postby Overload » Thu Jun 13, 2013 9:38 pm

There are quite a few syntax errors in your formula. You may want to look in the Formulas section of the StrataSearch Help to make sure you understand how each formula supposed to be used, especially the if() formulas. But here are at least a couple tips:

* The if() statement should have 3 parameters divided by commas. The first parameter is the expression (such as RSI(14)<30), the second is the value that will be returned by the if() statement if the expression is true, and the third parameter is the value that will be returned if the expression is false. For example:

result = if(RSI(14)<30, 1, 0);

* Also, you have multiple lines like this:

,);

The above is never valid, because there should always be a value after a comma and before a parenthese.

You might be trying to program too much at once. I would recommend starting with something smaller and working up to a larger formula, just to make sure you understand each step as you go along.

Pete
Overload
 
Posts: 2248
Joined: Wed Nov 30, 2005 12:14 pm

Re: Two Questions

Postby Kasmodean » Thu Jun 13, 2013 11:31 pm

Ok, thanks, I will take a look. The purpose of the ,); is in the case of a false value, I want nothing to be done. Most languages I have used are fine with empty cases or the lack of an else case.

So I trimmed it to the minimum and have:

//Formula: Weekly Percent Gain
DaysBack = parameter("Days");
x = DaysBack;
if(-x = 1, count= 1,count = 0);
WeeklyPG = Count;

I get error: Invalid variable name if(-x

But if I do:
//Formula: Weekly Percent Gain
DaysBack = parameter("Days");
x = DaysBack;
count = if(-x = 1, 1, 0);
WeeklyPG = Count;

It works.

So I think I was overestimating the capabilities of the if command. I was trying to execute commands within the if rather than just returning numbers. I may have to try a DLL to incorporate normal coding capabilities.

Thank you

Edit:

Actually, rewrote the code working with the limitations of the if statement. Actually lead to a simpler code with less ifs and no nesting.
Kasmodean
 
Posts: 3
Joined: Wed Jun 12, 2013 9:33 pm


Return to Technical Support

cron