|DYO Library and Discussion of #|
Ensign Howard, you send me a wonderful link so rich with examples of
various DYO commands. Can you discuss / point-out some of the five most
practical commands to use for logic control of program and five for arithmetic
17:11 Ensign Howard: MOW is referring to the Library of Examples page
17:12 Ensign Howard: This page has more than just a listing of examples, there is also a cross reference for types of DYO statements to examples that contain the statement. Scroll down on the page above to see the cross reference tables.
17:14 Ensign Howard: For example, in the Statements section, the first category is Bar Value and the first selection is Close + #. This is followed by cross references to 3 DYOs, such as Band, Hull Average, and Volatility Bands.
17:15 Ensign Howard: When you click on the Hull Average link you go to a web page example that shows the DYO implementation for the Hull Average
17:15 Ensign Howard: Line F of the example shows Bar Value | Close + # being used in context
17:16 Ensign Howard: Lets go back to the Library cross reference page, and to the Expression category
17:17 Ensign Howard: The 1st selection in the table is Value + # - Next, and the 1st example is Ave True Range.
17:18 Ensign Howard: The Line C and E in the DYO example show expression statements where Value is having a number added or subtracted.
17:18 Ensign Howard: In our notation, Value is the content of the Global Variable referenced by the Read GV, which in the example is GV
17:19 Ensign Howard: The - # or + # means the content of the number field is being subtracted or added to Value
17:19 Ensign Howard: In the example the number field contains a reference to another Global Variable and the GV referenced is  or GV.
17:20 Ensign Howard: If the Number field had just a number, like 2.0, it would have added 2 to Value, so Result of the line would be Value + 2.0
17:21 Ensign Howard: In the example, the digit 2 in the number filed has brackets around it, which changes the meaning to be a reference to a global variable, and  is the 2nd global variable.
17:21 Ensign Howard: So the Value - # with # =  means Result = Global Variable  - Global Variable 
17:22 Ensign Howard: And we see that GV received its value on Line A and GV received its value on Line B
17:23 Ensign Howard: So Line C results in plotting Ave High - Ave True Range
17:23 Ensign Howard: The Ave High is a 3 period average of the bar highs and Ave True Range is a 5 period average of the True Ranges.
17:25 Ensign Howard: Some of the Expression selections refer to Next and this is our notation for the Global Variable that immediately follows the Value reference.
17:25 Ensign Howard: So if Value is set by the Read GV and the Read GV index is a 15, then Next is GV
17:26 Ensign Howard: Some expressions have 3rd in the formula, such as (Value + Next + 3rd*(#-2))/#
17:26 Ensign Howard: 3rd is the notation for the 3rd GV in sequence. So if Value is GV, Next is GV, and 3rd is GV
17:27 Ensign Howard: The formula expression has just one starting pointer which is the Read GV selection. Lacking additional pointers, we use Next and 3rd to be defaults for adjacent GVs from the Read GV selection. Use Value + # with the GV reference in Number to operate on 2 non-adjacent GV references.
17:29 MakesOwnWeather: When I see a number sign (#) I always think of the value in the number field; but, by what indication will I know we are referring to GVs. When I see more than one, it is GVs. that are being referred to.
17:29 Ensign Howard: The expression will be in the form of Value + # It is YOU that controls the content of the Number field. If your number field entry is just a pure number, than the number is being added.
17:30 Ensign Howard: if the number field has a digit surrounded by square brackets, the brackets tell the program that this is a GV that needs to be looked up and the GV value is used as the number in the expression
17:31 Ensign Howard: So 2.0 is a pure number but  is Global Variable 's content that is the number to be used in the expression or  is the content of GV  that is the number
17:32 MakesOwnWeather: OK, so let me lock that in: Whenever there are multiple # in a formula, I must put the numbers I want to use in GVs and refer to them in brackets within the number field. Is that correct? (in sequential order)
17:33 Ensign Howard: In one of my examples there were 2 # characters in the formula. Let me repost the example
17:33 Ensign Howard: (Value + Next + 3rd * (#-2))/ #
17:34 Ensign Howard: there is ONLY one number field, so in the formula with # in two places, the value in the number field will be used TWICE. Just one number, but used in 2 places. You do NOT try to enter 2 numbers in the number field to have 2 different numbers
17:34 Ensign Howard:  would not work --  would work
17:35 MakesOwnWeather: OK, NOT EVER   for that example.
17:35 Ensign Howard: correct, never try 
17:36 Ensign Howard: Lets find an easy one to mentally use as example
17:37 Ensign Howard: (Value - # ) / # would be used to show the percent change from # to Value or 100 * ( Value - # ) / # would show the percent as a percentage
17:38 Ensign Howard: if # is 5 and Value is 6 then we have (6 - 5) / 5 for a 0.20 increase result
17:38 Ensign Howard: The point illustrated is that # is one value used in 2 places in the expression.