FAQ |
Top Previous Next |
Resize MEMORY[1] = 0 ~POSITION 'initialize the category IF (RISK / TOTALEQUITY) > MEMORY[1] THEN MEMORY[1] = _ (RISK / TOTALEQUITY)
~POSITION 'reinitialize the category and run through all 'the positions again; reduce the one with the highest risk if >10% IF MEMORY[1] > .1 AND RISK / TOTALEQUITY = MEMORY[1] THEN MULTIPLIER = .9
The first line of code, MEMORY[1] = 0, clears the memory variable at the start of each day. The second line of code under the Position category checks the risk in each position, and if it is the highest risk yet seen, saves it (assigns it's value to MEMORY[1]). Once all the positions have been processed the one whose risk is the largest % of equity has it's % stored in MEMORY[1] The value of MEMORY[1] persists across categories, and in the second position category, if the position with the highest risk, indeed risks more than 10% of equity, then reduce it's size by 10%.
For instance, you may wish to “pyramid” into an existing position when it reaches a certain level of profitability. In this case, for example, use SIZING[n] as a “flag,” and set it equal to 1 when the condition is true, and zero when the condition is false. Then, use that information like this: Resize ~POSITION IF SIZING[4] = 1 THEN MULTIPLIER = 1.25
|