2-day VWAP indicator
Forums › ProRealTime English forum › ProBuilder support › 2-day VWAP indicator
- This topic has 5 replies, 2 voices, and was last updated 9 months ago by Bogren.
-
-
03/11/2024 at 8:25 AM #229566
Hi,
I´m looking for a indicator that show 2-day VWAP on the chart. I know you can use booth the original VWAP and the anchored one and change settings to 2-days but that´s not how i think about it. The original one should show 2- days at the time, and the anchored you have to manually anchor at every day.
What I’m looking for is a model that starts a VWAP from today’s open just as the original one but doesn’t close the calculation before tomorrow´s close.
On a historical chart, you would then see the VWAP starting from each day’s opening but not closing until the next day’s close. In other words, it overlaps each other all the time. Then you can perhaps also color day 1 in one color and day 2 in another to easily separate them visually.
I´ve tried to code it myself but failed. My beginner skills is limited at the moment!
03/12/2024 at 10:54 AM #229650Hi
Try this1234567891011121314151617181920if opendate <> opendate[1] and newday=0 thennewday = 1startbar1 = 1elsif opendate <> opendate[1] and newday=1 thennewday = 0startbar2 = 1elsenewday = newdaystartbar1 = startbar1+1startbar2 = startbar2+1endif///VWAP 1d1 = max(1, startbar1)VWAP1 = SUMMATION[d1](volume*typicalprice)/SUMMATION[d1](volume)///VWAP 2d2 = max(1, startbar2)VWAP2 = SUMMATION[d2](volume*typicalprice)/SUMMATION[d2](volume)RETURN VWAP2 as "Vwap2" coloured("red"), vwap1 as "Vwap1"coloured("blue")1 user thanked author for this post.
03/15/2024 at 12:43 PM #229840Excellent @Iván !
Now i should try to use this indicator in a strategy with some other tools.
In a strategy for example, if i only want to to use the second day of both this vwap´s as an entry oportunity when a crossover arises (Because it´s acctuly then a 2- day VWAP arises).
How should that snippet looks like? I know the acctuly CROSSES OVER code.
Thanks in advance!
03/15/2024 at 2:10 PM #22985703/15/2024 at 7:36 PM #229869Thanks, but I’m aware of that.
The part of the code I’m looking for is to be able to specify so it only includes the second day. If price crosses the vwap on the first day, it is not a 2-day vwap cross but a regular one, thats not intresting. It is the second day of the 2-day vwap that is the interesting thing here.
Otherwise, you could have used the standard indicator for vwap and then that price or whatever you want crosses over with the code you attached last.
Thus, a code string that only includes crosses on the second day. That is the part of the code that is difficult for me.
Hope this make it clearer. If not, i could attach a pic to make it easier to understand.
03/20/2024 at 10:19 AM #230090 -
AuthorPosts
Find exclusive trading pro-tools on