I am trying to write a strategy for a price break of the VAMA using 16 days as its period time. I am a novice at writing, so I'd appreciated a "beginning to end" formula, if you've got the time.
Here is the basoc formula:
VAMA = (V1 * P1 + V2 * P2 + ... + Vn * Pn) / (V1 + V2 + ... + Vn)
Much appreciation,
Art
Size:
Color:
<<so I'd appreciated a "beginning to end" formula>>
Having a clear requirement or a "beginning to end" formula is the prerequisite to any programming. There is no clarity with this VAMA formula:
Volume adjusted moving averageVAMA (Volume Adjusted Moving Average) by Dick ArmsThe formula above is not VAMA but belongs to a native Wealth-Lab indicator called VMA. For more information, here is the indicator documentation:
VMAQUOTE:
Calculation
VMA = ( V1 * P1 + V2 * P2 + ... + Vn * Pn ) / ( V1 + V2 + ... + Vn )
where,
P1 = current price
P2 = price one bar ago, etc.
V1 = current volume
V2 = volume one bar ago
n = number of periods/bars
Size:
Color:
So, then using the VMA formula, could you help me write a program to identify when a stock breaks its 16 day moving average of that indicator?
Thanks.
Art
Size:
Color:
Sure but note that you can pretty easily use the Rule wizard for that.
1. Since VMA is already a moving average by itself, do you really want double smoothing? If yes then how do you want it to be smoothed and which period should be used?
2. What about exit conditions?
Size:
Color:
Sorry I may not have all the jargon down, but what I'd like to do is to identify when the stock price breaks above the VMA using 16 days as the fixed period for that average. I'd like to sell when it breaks below the VMA using the same 16 period. I went into the Rule wizard, but I don't find a rule specific for the VMA.
I hope that helps..............thanks
Size:
Color:
Only the most popular indicators have customized rules. For those that don't, use the General Indicators rule set. See User Guide: Strategy Window > Strategy Builder > General Rules
Size:
Color:
Size:
Color:
ok...........the video helps quite a bit. I can see how to get a signal when the indicator crosses the price, but not when the price crosses the indicator. Seems like it shouldn't be difficult. Thanks for your help.
Size:
Color:
That condition isn't available as a Rule, however it's a no-brainer in code-based strategy. The breakout condition as we know it doesn't seem to make sense with VMA because it will chop to death. Thererefore I'm including an alternative option to use the CrossOver/CrossUnder functions which is a more logical approach with MAs in general. Hope you get the picture:
CODE:
Please log in to see this code.
Size:
Color: