VWAP Time Frame Thinkorswim

Discussion in 'App Development' started by Diego443, Jun 14, 2018.

  1. Diego443

    Diego443

    Hi Traders,

    I am looking for a modified version of the vwap study in thinkorswim.

    I really like the way it is now but the fact that it keeps on resetting every day is not very productive on my daily timeframe.

    I know you can switch between days, weeks, and months but I want an extended timeframe.

    For example a "chart" timeframe. Something that is larger than the current ones. A yearly timeframe is also sometimes not very helpful because if there was big volume played in Dec. 2017 and I am playing the stock in Jan. 2018 the data is not valid.


    I would appreciate any kind of help as google couldnĀ“t help me out here.

    Thanks in advance,

    -Diego
     
  2. WeToddDid2

    WeToddDid2

    Last edited: Jun 14, 2018
  3. Vwap is made for intraday.
     
  4. timdug

    timdug

    Hey Diego, did you find anything? Im also looking for a year timeframe VWAP on TOS.
     
  5. comagnum

    comagnum

    Here is the Think or Swim code for multi-day VWAP - you select the start date, you can day 2 days, 50 days, a year, etc.


    input startDateYyyyMmDd = 20171116;
    def beyondStartDate = if GetYYYYMMDD() >= startDateYyyyMmDd then 1 else 0;
    plot VWAP = TotalSum(if beyondStartDate then (((high + low + close) / 3) * volume) else 0) / TotalSum(if beyondStartDate then volume else 0);
    VWAP.SetDefaultColor(Color.ORANGE);
    VWAP.SetStyle(Curve.SHORT_DASH);
    VWAP.SetLineWeight(1);


    upload_2018-11-16_11-42-32.png
     
    rossneptune and Diego443 like this.
  6. timdug

    timdug

    I dont see that as a real years VWAP.?? I got a proper one coded up in Thinkscript if you are interested? PM me for details.
     
  7. comagnum

    comagnum

    The Think or Swim VWAP code I posted is correct - it is in perfect sync with the multi-day VWAP codes widely used by many on TradeStation & TradingView. It is accurate.


    TradingView 1 year VWAP
    upload_2018-11-21_4-1-25.png

    Tradestation 1 year VWAP

    upload_2018-11-21_4-9-26.png

    Think or Swim 1 year VWAP
    upload_2018-11-21_4-10-54.png
     
    Last edited: Nov 21, 2018
    rossneptune and timdug like this.
  8. mdh263

    mdh263

    is there any way to get this indicator to work for for a specific time?
     
  9. mdh263

    mdh263

    i think i figured it out

    input startDateYyyyMmDd = 20181118;
    input startTimeHHMM = 0930;
    def beyondStartDate = if GetYYYYMMDD() >= startDateYyyyMmDd then 1 else 0;
    def beyondStartTime = if SecondsfromTime(startTimeHHMM) >= 0 then 1 else 0;
    plot VWAP = TotalSum(if beyondStartDate and beyondStartTime then (((high + low + close) / 3) * volume) else 0) / TotalSum(if beyondStartDate and beyondStartTime then volume else 0);
    VWAP.SetDefaultColor(Color.ORANGE);
    VWAP.SetStyle(Curve.SHORT_DASH);
    VWAP.SetLineWeight(1);
     
    rossneptune and Diego443 like this.
  10. Wahawk

    Wahawk

    Can you standard dev. To this code? Thanks
     
    #10     Dec 9, 2018