EasyLanguage VWAP code help - Open E Cry | futures io social day trading
futures io futures trading


EasyLanguage VWAP code help
Updated: Views / Replies:6,687 / 12
Created: by MilesT Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 1  
 
Thread Tools Search this Thread
 

EasyLanguage VWAP code help

  #1 (permalink)
Elite Member
Orlando, FL
 
Futures Experience: Intermediate
Platform: OEC
Broker/Data: VanKar/OEC
Favorite Futures: 6E
 
Posts: 11 since Dec 2011
Thanks: 44 given, 10 received

EasyLanguage VWAP code help

I need some help modifying an EL VWAP indicator I found. It does what I want except for the start time. I would like it to start daily at 1800 ET instead of midnight. Sounds like a simple adjustment if you are not a dummy like me.
Any help would be much appreciated.

vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),
standarddeviation(0);
If date > date[1]
then
begin
Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum);
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation);

Reply With Quote
 
  #2 (permalink)
Man wearing a tuque
Calgary, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: IB, IQFeed
Favorite Futures: GC
 
Lampert's Avatar
 
Posts: 76 since Nov 2011
Thanks: 73 given, 131 received

MT - You just need to modify the code as shown below, between the /// lines. It tested OK in Multicharts.
 
Code
vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

///
standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= 1800 and OncePerDay = 0 then begin
OncePerDay = 1 ;
///	 
	 
Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum); 
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation);

Len


Last edited by Lampert; March 27th, 2012 at 02:59 PM.
Reply With Quote
The following 2 users say Thank You to Lampert for this post:
 
  #3 (permalink)
Elite Member
Orlando, FL
 
Futures Experience: Intermediate
Platform: OEC
Broker/Data: VanKar/OEC
Favorite Futures: 6E
 
Posts: 11 since Dec 2011
Thanks: 44 given, 10 received


Worked like a charm. Thank you very much for your help Len.

Reply With Quote
The following user says Thank You to MilesT for this post:
 
  #4 (permalink)
Elite Member
Orlando, FL
 
Futures Experience: Intermediate
Platform: OEC
Broker/Data: VanKar/OEC
Favorite Futures: 6E
 
Posts: 11 since Dec 2011
Thanks: 44 given, 10 received

Need more help...

Len,

Can you help me make the start time an input instead of hard coded?

Thanks in advance,

Miles

vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

///
standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= 1800 and OncePerDay = 0 then begin
OncePerDay = 1 ;
///

Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum);
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation);

Reply With Quote
 
  #5 (permalink)
Elite Member
Orlando, FL
 
Futures Experience: Intermediate
Platform: OEC
Broker/Data: VanKar/OEC
Favorite Futures: 6E
 
Posts: 11 since Dec 2011
Thanks: 44 given, 10 received

Problem solved

I figured it out. Here it is in case any one is interested...changes in red...

input: time_start (1800);
vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= time_start and OncePerDay = 0 then begin
OncePerDay = 1 ;

Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum);
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation);

Reply With Quote
The following 2 users say Thank You to MilesT for this post:
 
  #6 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
Posts: 261 since Jul 2011
Thanks: 288 given, 332 received

Plotting range

Could somebody please add the ability to only plot the VWAP starting from a start time and ending at an end time in the code below? In other words, the VWAP would only be visible on the chart from say 930 - 1615. The reason for this is that you can use an ETH chart but plot an RTH VWAP. Right now the VWAP calculates from the input time but it plots throughout the chart.

Thanks.

 
Code
input: time_start (1800), upColor(Cyan), dnColor(Magenta);

vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= time_start and OncePerDay = 0 then begin
OncePerDay = 1 ; 

Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum); 
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation); 

var: var1(yellow);
if vwap > vwap[1] then var1 = upColor;
if vwap < vwap[1] then var1 = dnColor;
SetPlotColor(1,var1);

Reply With Quote
 
  #7 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
Posts: 261 since Jul 2011
Thanks: 288 given, 332 received

Can anybody help with the above code?

Reply With Quote
 
  #8 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received


olobay View Post
Could somebody please add the ability to only plot the VWAP starting from a start time and ending at an end time in the code below? In other words, the VWAP would only be visible on the chart from say 930 - 1615. The reason for this is that you can use an ETH chart but plot an RTH VWAP. Right now the VWAP calculates from the input time but it plots throughout the chart.

Thanks.

 
Code
input: time_start (1800), upColor(Cyan), dnColor(Magenta);

vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= time_start and OncePerDay = 0 then begin
OncePerDay = 1 ; 

Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum); 
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation); 

var: var1(yellow);
if vwap > vwap[1] then var1 = upColor;
if vwap < vwap[1] then var1 = dnColor;
SetPlotColor(1,var1);


olobay View Post
Can anybody help with the above code?


Just by looking at the code, no idea if it will work is change


 
Code
standarddeviation=SquareRoot(deviationsum); 
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation);
to

 
Code
standarddeviation=SquareRoot(deviationsum); 
if time <= 1615 then begin
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation); 
end;

Reply With Quote
The following user says Thank You to treydog999 for this post:
 
  #9 (permalink)
Elite Member
Montreal
 
Futures Experience: Intermediate
Platform: MultiCharts
Broker/Data: IB Canada/IQFeed
Favorite Futures: TF, CL
 
Posts: 261 since Jul 2011
Thanks: 288 given, 332 received


treydog999 View Post
Just by looking at the code, no idea if it will work is change

 
Code
standarddeviation=SquareRoot(deviationsum); 
if time <= 1615 then begin
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation); 
end;

Thanks @treydog999 but it did not work.

Reply With Quote
 
  #10 (permalink)
Elite Member
seoul, Korea
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: CQG, DTN IQfeed
Favorite Futures: YM 6E
 
treydog999's Avatar
 
Posts: 894 since Jul 2012
Thanks: 291 given, 1,006 received



olobay View Post
Thanks @treydog999 but it did not work.

 
Code
input: time_start (0930), time_end (1615), upColor(Cyan), dnColor(Magenta);

vars: vwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

standarddeviation(0),
OncePerDay(0);
If date > date[1] then OncePerDay = 0 ;
If Time >= time_start and OncePerDay = 0 then begin
OncePerDay = 1 ; 

Barfromstart=0;
pv=AvgPrice*volume;
Totalvolume=volume;
vwap=pv/totalvolume;
end
else
begin
Barfromstart=Barfromstart[1]+1;
pv=pv[1] + AvgPrice*Volume;
Totalvolume=Totalvolume[1] + Volume;
vwap=pv/Totalvolume;
end;
deviationsum=0;
for value1= 0 to Barfromstart
begin
Squareddeviations=Square( vwap-avgprice[value1]);
Probabilityweighteddeviations=volume[value1]*Squareddeviations/Totalvolume;
deviationsum=deviationsum +Probabilityweighteddeviations;
end;

standarddeviation=SquareRoot(deviationsum); 
if time <= time_end and time >= time_start then begin
Plot1(vwap);
Plot2(vwap+standarddeviation);
Plot3(vwap+2*standarddeviation);
Plot4(vwap-standarddeviation);
Plot5(vwap-2*standarddeviation); 
end
else begin
Plot1(0); // outside of session plots, edit as needed
Plot2(0);
Plot3(0);
Plot4(0);
Plot5(0); 
end;

var: var1(yellow);
if vwap > vwap[1] then var1 = upColor;
if vwap < vwap[1] then var1 = dnColor;
SetPlotColor(1,var1);
This is just a really quick fix, it makes the plots plot 0 when its outside of your time, so they are basically hidden. But as you can see in my screenshot it makes vertical lines. which may be annoying. but at least you have the time function that is customizable.


Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Reply With Quote
The following 2 users say Thank You to treydog999 for this post:

Reply



futures io > > > > EasyLanguage VWAP code help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using VWAP in your trading Big Mike The Elite Circle 173 January 25th, 2016 10:22 PM
VWAP bands crazybears NinjaTrader 102 March 6th, 2012 05:33 PM
Intrabar VWAP Eubie NinjaTrader Programming 6 February 3rd, 2012 06:12 PM
BMT CCI Pivot Zone easylanguage code for Market Delta? kienow Investor/RT 1 February 16th, 2011 03:37 PM
VWAP question Todd NinjaTrader Programming 3 March 14th, 2010 07:13 PM


All times are GMT -4. The time now is 12:32 AM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.14 seconds with 20 queries on phoenix via your IP 54.221.93.187