# VWMA Breakout Strategy
# TD Ameritrade IP Company, Inc. (c) 2017-2019
# Modified by BenTen at useThinkScript.com
# Added arrows to use with the Scanner
input vwmaLength = 50;
input maLength = 70;
input averageType = AverageType.SIMPLE;
plot VWMA = Sum(volume * close, vwmaLength) / Sum(volume, vwmaLength);
plot MA = MovingAverage(averageType, close, maLength);
VWMA.SetDefaultColor(GetColor(1));
MA.SetDefaultColor(GetColor(2));
def buy = VWMA crosses above MA;
def sell = VWMA crosses below MA;
plot bullish = buy;
bullish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_Arrow_UP);
bullish.SetDefaultColor(Color.LIME);
bullish.SetLineWeight(1);
plot bearish = sell;
bearish.SetPaintingStrategy(PaintingStrategy.BOOLEAN_Arrow_DOWN);
bearish.SetDefaultColor(Color.LIME);
bearish.SetLineWeight(1);
MovAvgWeighted("length" = 50) crosses above SimpleMovingAverage("length" = 70) within 3 bars
MovAvgWeighted("length" = 50) crosses below SimpleMovingAverage("length" = 70) within 3 bars
No, it is the Volume Weighted Moving Average (VWMA), the VWAP throws price into the mix.
input LENGTH = 5;
input displace = 0;
def VWMA = Sum(volume * close) / Sum(volume);
plot MYVWMA = Average(VWMA[-displace], LENGTH);
# ########################################################
# VWMA MTF
# @MerryDay 7/2021
# ########################################################
# MTF definitions
input agg = aggregationPeriod.HOUR ;
def mtf_volume = volume(period = agg) ;
def mtf_price = close(period = agg) ;
# ########################################################
input vwmaLength = 50;
input averageType = AverageType.SIMPLE;
plot VWMA = Sum(mtf_volume * mtf_price, vwmaLength) / Sum(mtf_volume, vwmaLength);
VWMA.SetDefaultColor(color.violet) ;
def total_volume = sum(volume,10);
def vw = (volume/total_volume);
def vw2 = (volume()[1]/total_volume);
def vw3 = (volume()[2]/total_volume);
def vw4 = (volume()[3]/total_volume);
def vw5 = (volume()[4]/total_volume);
def vw6 = (volume()[5]/total_volume);
def vw7 = (volume()[6]/total_volume);
def vw8 = (volume()[7]/total_volume);
def vw9 = (volume()[8]/total_volume);
def vw10 = (volume()[9]/total_volume);
def vwp = close * vw;
def vwp2 = close[1] * vw2;
def vwp3 = close[2] * vw3;
def vwp4 = close[3] * vw4;
def vwp5 = close[4] * vw5;
def vwp6 = close[5] * vw6;
def vwp7 = close[6] * vw7;
def vwp8 = close[7] * vw8;
def vwp9 = close[8] * vw9;
def vwp10 = close[9]* vw10;
plot ema = expaverage(vwp + vwp2 + vwp3 + vwp4 + vwp5 + vwp6 + vwp7 + vwp8 + vwp9 + vwp10 );
ema.SetDefaultColor(GetColor(1));
def total_volume = sum(volume,20);
def vw = (volume/total_volume);
def vw2 = (volume()[1]/total_volume);
def vw3 = (volume()[2]/total_volume);
def vw4 = (volume()[3]/total_volume);
def vw5 = (volume()[4]/total_volume);
def vw6 = (volume()[5]/total_volume);
def vw7 = (volume()[6]/total_volume);
def vw8 = (volume()[7]/total_volume);
def vw9 = (volume()[8]/total_volume);
def vw10 = (volume()[9]/total_volume);
def vwp = close * vw;
def vwp2 = close[1] * vw2;
def vwp3 = close[2] * vw3;
def vwp4 = close[3] * vw4;
def vwp5 = close[4] * vw5;
def vwp6 = close[5] * vw6;
def vwp7 = close[6] * vw7;
def vwp8 = close[7] * vw8;
def vwp9 = close[8] * vw9;
def vwp10 = close[9]* vw10;
def vw11 = (volume[10]/total_volume);
def vw12 = (volume()[11]/total_volume);
def vw13 = (volume()[12]/total_volume);
def vw14 = (volume()[13]/total_volume);
def vw15 = (volume()[14]/total_volume);
def vw16 = (volume()[15]/total_volume);
def vw17 = (volume()[16]/total_volume);
def vw18 = (volume()[17]/total_volume);
def vw19 = (volume()[18]/total_volume);
def vw20 = (volume()[19]/total_volume);
def vwp11 = close[10] * vw11;
def vwp12 = close[11] * vw12;
def vwp13 = close[12] * vw13;
def vwp14 = close[13] * vw14;
def vwp15 = close[14] * vw15;
def vwp16 = close[15] * vw16;
def vwp17 = close[16] * vw17;
def vwp18 = close[17] * vw18;
def vwp19 = close[18] * vw19;
def vwp20 = close[19]* vw20;
plot ema = expaverage(vwp + vwp2 + vwp3 + vwp4 + vwp5 + vwp6 + vwp7 + vwp8 + vwp9 + vwp10 + vwp11 + vwp12 + vwp13 + vwp14 + vwp15 + vwp16 + vwp17 + vwp18 + vwp19 +vwp20 );
ema.SetDefaultColor(GetColor(1));
def total_volume = sum(volume,50);
def vw = (volume/total_volume);
def vw2 = (volume()[1]/total_volume);
def vw3 = (volume()[2]/total_volume);
def vw4 = (volume()[3]/total_volume);
def vw5 = (volume()[4]/total_volume);
def vw6 = (volume()[5]/total_volume);
def vw7 = (volume()[6]/total_volume);
def vw8 = (volume()[7]/total_volume);
def vw9 = (volume()[8]/total_volume);
def vw10 = (volume()[9]/total_volume);
def vwp = close * vw;
def vwp2 = close[1] * vw2;
def vwp3 = close[2] * vw3;
def vwp4 = close[3] * vw4;
def vwp5 = close[4] * vw5;
def vwp6 = close[5] * vw6;
def vwp7 = close[6] * vw7;
def vwp8 = close[7] * vw8;
def vwp9 = close[8] * vw9;
def vwp10 = close[9]* vw10;
def vw11 = (volume()[10]/total_volume);
def vw12 = (volume()[11]/total_volume);
def vw13 = (volume()[12]/total_volume);
def vw14 = (volume()[13]/total_volume);
def vw15 = (volume()[14]/total_volume);
def vw16 = (volume()[15]/total_volume);
def vw17 = (volume()[16]/total_volume);
def vw18 = (volume()[17]/total_volume);
def vw19 = (volume()[18]/total_volume);
def vw20 = (volume()[19]/total_volume);
def vwp11 = close[10] * vw11;
def vwp12 = close[11] * vw12;
def vwp13 = close[12] * vw13;
def vwp14 = close[13] * vw14;
def vwp15 = close[14] * vw15;
def vwp16 = close[15] * vw16;
def vwp17 = close[16] * vw17;
def vwp18 = close[17] * vw18;
def vwp19 = close[18] * vw19;
def vwp20 = close[19] * vw20;
def vw21 = (volume()[20]/total_volume);
def vw22 = (volume()[21]/total_volume);
def vw23 = (volume()[22]/total_volume);
def vw24 = (volume()[23]/total_volume);
def vw25 = (volume()[24]/total_volume);
def vw26 = (volume()[25]/total_volume);
def vw27 = (volume()[26]/total_volume);
def vw28 = (volume()[27]/total_volume);
def vw29 = (volume()[28]/total_volume);
def vw30 = (volume()[29]/total_volume);
def vwp21 = close[20] * vw[21];
def vwp22 = close[21] * vw2[22];
def vwp23 = close[22] * vw3[23];
def vwp24 = close[23] * vw4[24];
def vwp25 = close[24] * vw5[25];
def vwp26 = close[25] * vw6[26];
def vwp27 = close[26] * vw7[27];
def vwp28 = close[27] * vw8[28];
def vwp29 = close[28] * vw9[29];
def vwp30 = close[29] * vw10[30];
def vw31 = (volume()[30]/total_volume);
def vw32 = (volume()[31]/total_volume);
def vw33 = (volume()[32]/total_volume);
def vw34 = (volume()[33]/total_volume);
def vw35 = (volume()[34]/total_volume);
def vw36 = (volume()[35]/total_volume);
def vw37 = (volume()[36]/total_volume);
def vw38 = (volume()[37]/total_volume);
def vw39 = (volume()[38]/total_volume);
def vw40 = (volume()[39]/total_volume);
def vwp31 = close[30] * vw31;
def vwp32 = close[31] * vw32;
def vwp33 = close[32] * vw33;
def vwp34 = close[33] * vw34;
def vwp35 = close[34] * vw35;
def vwp36 = close[35] * vw36;
def vwp37 = close[36] * vw37;
def vwp38 = close[37] * vw38;
def vwp39 = close[38] * vw39;
def vwp40 = close[39] * vw40;
def vw41 = (volume()[40]/total_volume);
def vw42 = (volume()[41]/total_volume);
def vw43 = (volume()[42]/total_volume);
def vw44 = (volume()[43]/total_volume);
def vw45 = (volume()[44]/total_volume);
def vw46 = (volume()[45]/total_volume);
def vw47 = (volume()[46]/total_volume);
def vw48 = (volume()[47]/total_volume);
def vw49 = (volume()[48]/total_volume);
def vw50 = (volume()[49]/total_volume);
def vwp41 = close[40] * vw41;
def vwp42 = close[41] * vw42;
def vwp43 = close[42] * vw43;
def vwp44 = close[43] * vw44;
def vwp45 = close[44] * vw45;
def vwp46 = close[45] * vw46;
def vwp47 = close[46] * vw47;
def vwp48 = close[47] * vw48;
def vwp49 = close[48] * vw49;
def vwp50 = close[49] * vw50;
plot sma = average(vwp + vwp2 + vwp3 + vwp4 + vwp5 + vwp6 + vwp7 + vwp8 + vwp9 + vwp10 + vwp11 + vwp12 + vwp13 + vwp14 + vwp15 +vwp16 + vwp17 + vwp18 +vwp19 +vwp20 +vwp21 + vwp22 + vwp23 + vwp24 + vwp25 + vwp26 +vwp27 + vwp28 + vwp29 + vwp30 + vwp31 + vwp32 + vwp33 + vwp34 + vwp35 + vwp36 + vwp37 + vwp38 + vwp39 + vwp40 + vwp41 + vwp42 + vwp43 + vwp44 + vwp45 + vwp46 + vwp47 + vwp48 + vwp49 + vwp50 );
sma.SetDefaultColor(GetColor(1));
I moved your post here. You will find the VWMA scripts in this thread, a wee bit more concise.I was reading about volume-weighted moving average and this was what I could come up with. I noticed that when I used the simple moving average for shorter periods the value would be quite low, so I calculated the exponential moving average instead, also when I calculated the 50 periods it would vary widely on the chart, I am not sure if I made a mistake in the code. I am hoping someone could possibly simplify/audit the codes
.
Not sure what you are asking. The script in the top post is not 'locked'Hello BenTen---Capt Bob here ---I like your study and I've incorporated another study to weed out the false signals and would like the code to the original Vwma ---I assume you wrote the original code or have it . I need it to automate my strat. Is this possible to obtain. Tks Capt Bob
Good evening Benten---This code seems to be locked can I get an unlocked version for my Strat. As I added another study to eliminate some false trades. Thanks Capt.Bob
Hello Benten---can you send me a version that eliminates the words on the chart. The code seems to be locked and all I need is arrows up or down. I'm new to TOS and as I said before I've got another study that will eliminate a lot of false trades but need the code to make it happen please advise if this is possible. Thanks Capt.Bob
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.
We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.
If you are new, or just looking for guidance, here are some helpful links to get you started.