NexusFi: Find Your Edge


Home Menu

 





Is it possible to port TOS's Vwap indicator to NT8?


Discussion in NinjaTrader

Updated
    1. trending_up 2,643 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 bobbydigital83 
San Francisco Ca/USA
 
Experience: Advanced
Platform: tos
Trading: es
Posts: 29 since Jan 2019
Thanks Given: 12
Thanks Received: 7

I was told that NT8's Vwap is not the same as TOS's Vwap.

I wanted to first ask if this is true and if its possible to port TOS's Vwap over to NT8? Many thanks in advance!

This is TOS's standard Vwap:

#
# TD Ameritrade IP Company, Inc. (c) 2011-2020
#

input numDevDn = -2.0;
input numDevUp = 2.0;
input timeFrame = {default DAY, WEEK, MONTH};

def cap = getAggregationPeriod();
def errorInAggregation =
timeFrame == timeFrame.DAY and cap >= AggregationPeriod.WEEK or
timeFrame == timeFrame.WEEK and cap >= AggregationPeriod.MONTH;
assert(!errorInAggregation, "timeFrame should be not less than current chart aggregation period");

def yyyyMmDd = getYyyyMmDd();
def periodIndx;
switch (timeFrame) {
case DAY:
periodIndx = yyyyMmDd;
case WEEK:
periodIndx = Floor((daysFromDate(first(yyyyMmDd)) + getDayOfWeek(first(yyyyMmDd))) / 7);
case MONTH:
periodIndx = roundDown(yyyyMmDd / 100, 0);
}
def isPeriodRolled = compoundValue(1, periodIndx != periodIndx[1], yes);

def volumeSum;
def volumeVwapSum;
def volumeVwap2Sum;

if (isPeriodRolled) {
volumeSum = volume;
volumeVwapSum = volume * vwap;
volumeVwap2Sum = volume * Sqr(vwap);
} else {
volumeSum = compoundValue(1, volumeSum[1] + volume, volume);
volumeVwapSum = compoundValue(1, volumeVwapSum[1] + volume * vwap, volume * vwap);
volumeVwap2Sum = compoundValue(1, volumeVwap2Sum[1] + volume * Sqr(vwap), volume * Sqr(vwap));
}
def price = volumeVwapSum / volumeSum;
def deviation = Sqrt(Max(volumeVwap2Sum / volumeSum - Sqr(price), 0));

plot VWAP = price;
plot UpperBand = price + numDevUp * deviation;
plot LowerBand = price + numDevDn * deviation;

VWAP.setDefaultColor(getColor(0));
UpperBand.setDefaultColor(getColor(2));
LowerBand.setDefaultColor(getColor(4));


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
400 Million Barrels to Address Middle East Supply Disruption
Commodities
May 26 Deadline Dies at 7.5% as US Strikes Iran During C …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
April CPI Preview: +3.7% YoY Expected at 8:30 AM ET -- C …
Traders Hideout
Iran Talks Final Stages -- Two VLCCs Exit Hormuz, Record …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
Trying to learn Volume and price action correlation
5 thanks
  #2 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114

A VWAP is just a VWAP or volume-weighted average price of all transactions for a specific security over a time interval. It typically has an anchor point where the calculation starts. Most of the time you would select the start of the trading session as anchor point, and your chart will then show the VWAP of the current day.

Once you select identical anchor points for NinjaTrader and TOS VWAPs, you should get identical results.
You may further add standard deviation bands to the VWAP.

NinjaTrader 8 VWAPs with standard deviation bands are availble here:

https://nexusfi.com/local_links.php?linkid=1897
https://nexusfi.com/local_links.php?linkid=1898
https://nexusfi.com/local_links.php?linkid=1900
https://nexusfi.com/local_links.php?linkid=1901


Reply With Quote




Last Updated on July 19, 2020


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts