SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus -- Ignore unavailable to you. Want to Upgrade?


To: Ken Adams who wrote (5411)7/16/1998 12:28:00 PM
From: Nazbuster  Read Replies (2) | Respond to of 11149
 
Ken,

In general, the QP2 language is actually very easy to learn, but you have to pay GREAT attention to the details, especially the punctuation. (The language is derived from BASIC, a programming language which has been around for many years.) When writing your code, watch out for the following:

Spaces are ignored. Use them for clarity.

Statements end with a semi-colon. Don't put one after a "phrase", only the whole statement. For example,

for i=1 to 10 //implies STEP by +1 if omitted
do //required by QP2, optional/missing in other BASICs
xxx xxx;
xxx;
next i;

Note that the ";" for the "for/next" STATEMENT is after the "next i;", not the "for i=1 to 10" or the "do". Each STATEMENT within the loop gets its own semicolon.

Variables are INTEGER (whole numbers only), FLOAT (if you need decimals), or STRING (for alpha stuff). Declare all variables up front, ending the definition with semicolon: INTEGER a,b,c; (You can use more than one declaration of each type to get all variables defined.)

There is no way to define a variable as GLOBAL or STATIC so its value is retained from symbol to symbol. There is also no way to define an array of variables like "FLOAT sum(10);" to create 10 "cells", each called "sum" so you can create 10 different totals via "sum(5)=sum(5) + close(i);".

When doing calculations, there is a priority order for the arithmetic which usually means multiplication and division before addition or subtraction. Therefore 6+12/3+5 would be 15 not 11. When in doubt, use parentheses to make things clear: (6+(12/3)+5).

There doesn't seem to be exponentiation which is usually expressed as "**" or "^". (Too bad.)

Never set up a situation where you might divide by zero.

Use (or non-use) of the Equal sign is VERY confusing in QP2. This is the WORST part of the QP2 language syntax. You just have to memorize this stuff:

(1) When SETTING values for QP2-defined VARIABLES, use the equal sign. "DaysToLoad = 500;", "input='xxx';"
(2) When SETTING values for QP2 INDICATORS, use the SET statement:
"Set MACD = 8,17,9;"
(3) SETTING the value of QP2-defined SWITCHES seems to be more of a declaration than setting values and does not use the equal sign: "IssueType Common;"
(4) SETTING the value of variables YOU defined is done with the colon-equal: := (I hate this syntax.) "MyVariable := 35;"
(5) In TESTING values (in if/endif statements), use the equal sign: "If a=5 then..."

There are two types of conditional situations in QP2: For/Next and If/Endif.
(1) For/Next is a looping process controlled by the dependent variable and its max/min value.
(2) If/Endif conditions can be joined by AND, OR, and NOT. (You can use &. |, and ! in place of AND, OR and NOT.) Use parens for clarity.
(3) You can "NEST" statements to set up a loop or condition within another:

if a = 1 then
if b < 10 then
xxx;
endif;
else
if b > 10 then
xxx;
else
xxx;
endif;
endif;


I don't know if there is a proper way to exit a for-next loop. Some BASICs permit this via a GOTO branching statement or an EXITLOOP type of statement. The HELP file doesn't seem to address this.

Hope all this helps.



To: Ken Adams who wrote (5411)7/16/1998 3:05:00 PM
From: Enchante  Read Replies (3) | Respond to of 11149
 
Can Ken or anyone explain the QP2/QV/WOW process.

I'm having real problems trying to get QP2, QV and WOW to all work together. After this post, I'm on my way over to Andy's web page hoping to find a concise post of how to 1) get the initial virtual directory setup and populated, 2) create some smaller directories with scanned results and 3) get the download/scan/update process running smoothly so I can finally starting fooling around with actually learning some TA!

I've been having a wonderful time learning new TA techniques from the TA-Beginners thread and have found plenty of scans and trading systems to play with. Unfortunately, I haven't found the right series of incantations to get everything running together smoothly

I'm franically working my way through this thread looking for answers. Back in June there was a flurry of QV activity. Did anyone ever post "here's how I did/do it"? If not, does anyone care to now?

Carl