indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Technical > Indicators & Systems

Indicators & Systems Compendium of Code

RCRT Robo
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-07-2010, 10:45 AM
deepakpatade deepakpatade is offline
Newbie
 
Join Date: Dec 2009
Posts: 4
Thanks: 1
Thanked 2 Times in 1 Post
deepakpatade is on a distinguished road
Post Average traded Price System = AFL

Hello, While reading through the net I stumbled on this .
" " " The theory is that if the price of a buy trade is lower than the VWAP, it is a good trade. The opposite is true if the price is higher than the VWAP.

VWAP is often used as a trading benchmark by investors who aim to be as passive as possible in their execution. Many pension funds, and some mutual funds, fall into this category. The aim of using a VWAP trading target is to ensure that the trader executing the order does so in-line with volume on the market. It is sometimes argued[by whom?] that such execution reduces transaction costs by minimizing market impact (the adverse effect of a trader's activities on the price of a security).

VWAP is often used in algorithmic trading. Indeed, a broker may guarantee execution of an order at the VWAP price and have a computer program enter the orders into the market in order to earn the trader's commission and create P&L. This is called a Guaranteed VWAP execution.

The VWAP is calculated using the following formula:

where:
PVWAP = Volume Weighted Average Price
Pj = price of trade j
Qj = quantity of trade j
j = each individual trade that takes place over the defined period of time, excluding cross trades and basket cross trades.


The average price of a stock purchase or sale is equal to the stock price of each lot multiplied by the share amount, divided by the total share bought or sold. " " ">
==========================================


Hence i thought that i shall start building a system arounf this concept.
I had my veiw straight,that this system should give fair results if concluded properly even before i started working on it.
Reason -- This strategy is more linked to institutional treders and fund houses, may be big brokers.
AFter a careful study ( study still going on ), i have arrived at some formulas, but initially i need help in writing the afl for average traded price( average price).
I have got some downloaded from the net BUT unfortunately none ,matches.

can any seniot members help me with a afl and then we can move on to the next step
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to deepakpatade For This Useful Post:
  #2 (permalink)  
Old 05-07-2010, 02:19 PM
Adheer's Avatar
Adheer Adheer is offline
Regulars
 
Join Date: Apr 2009
Posts: 528
Thanks: 265
Thanked 2,321 Times in 469 Posts
Adheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to behold
Default

Quote:
The theory is that if the price of a buy trade is lower than the VWAP, it is a good trade. The opposite is true if the price is higher than the VWAP.

There is no logic to that theory. For every buyer there is a seller. If everyone keeps buying below the VWAP, the market and VWAP will keep going down.

NSE and BSE provides data from which you can calculate daily VWAP. Simply divide Total Traded Value / Num of Shares, and you get VWAP for the day.

I know of couple of very successful traders who use daily VWAP, aggregate VWAP over last N days, relative changes to VWAP, and most importantly patterns in Delivery Marking (both absolute and %) and OI in futures segment.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to Adheer For This Useful Post:
  #3 (permalink)  
Old 05-07-2010, 06:53 PM
deepakpatade deepakpatade is offline
Newbie
 
Join Date: Dec 2009
Posts: 4
Thanks: 1
Thanked 2 Times in 1 Post
deepakpatade is on a distinguished road
nope that is what is required

you are right,
all i want is the average price of that stock or future in real time to take my call.
my question is how to write a afl for that.
That is what i need
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-07-2010, 11:47 AM
Adheer's Avatar
Adheer Adheer is offline
Regulars
 
Join Date: Apr 2009
Posts: 528
Thanks: 265
Thanked 2,321 Times in 469 Posts
Adheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to behold
Default

Originally Posted by deepakpatade View Post
you are right,
all i want is the average price of that stock or future in real time to take my call.
my question is how to write a afl for that.
That is what i need

Your real-time quote provider will provide the VWAP.

Then have a trigger

Buy = C > VWAP;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-07-2010, 05:08 PM
devanand25 devanand25 is offline
Regulars
 
Join Date: Mar 2010
Posts: 110
Thanks: 30
Thanked 115 Times in 47 Posts
devanand25 will become famous soon enoughdevanand25 will become famous soon enough
Default VWAP INTRADAY afl is here

Hi Friends

Try this standard afl for VWAP

==================================


//Your real-time quote provider will provide the VWAP.

//Then have a trigger

//Buy =C>VWAP;
_SECTION_BEGIN("VWAP");
/*
The VWAP for a stock is calculated by adding the dollars traded for every
transaction in that stock ("price" x "number of
shares traded") and dividing the total shares traded. A VWAP is computed
from the Open of the market to the market Close, AND is
calculated by Volume weighting all transactions during this time period
*/

Bars_so_far_today = 1 + BarsSince( Day() != Ref(Day(), -1));
StartBar = ValueWhen(TimeNum() == 090000, BarIndex());
TodayVolume = Sum(V,Bars_so_far_today);
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) /
TodayVolume,0);
Plot (VWAP,"VWAP",colorBlue, styleThick);

_SECTION_END();

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

_SECTION_BEGIN("Background");
SetChartOptions(0,chartShowArrows|chartShowDates);
if( ParamToggle("Tooltip shows", "All Values|Only Prices" ) )
{
ToolTip=StrFormat("Open: %g\nHigh: %g\nLow: %g\nClose: %g
(%.1f%%)\nVolume: "+NumToStr( V, 1 ), O, H, L, C, SelectedValue( ROC( C, 1
)));
}

Buy =C>VWAP;


/* The theory is that if the price of a Buy trade is lower than the VWAP, it is a good trade. The opposite is True if the price is higher than the VWAP.

VWAP is often used as a trading benchmark by investors who aim to be as passive as possible in their execution. Many pension funds, AND some mutual funds, fall into this category. The aim of using a VWAP trading target is to ensure that the trader executing the order does so in-line with Volume on the market. It is sometimes argued[by whom?] that such execution reduces transaction costs by minimizing market impact (the adverse effect of a trader's activities on the price of a security).

VWAP is often used in algorithmic trading. Indeed, a broker may guarantee execution of an order at the VWAP price AND have a computer program enter the orders into the market in order to earn the trader's commission AND create P&L. This is called a Guaranteed VWAP execution.

The VWAP is calculated using the following formula:

where:
PVWAP = Volume Weighted Average Price
Pj = price of trade j
Qj = quantity of trade j
j = each individual trade that takes place over the defined period of time, excluding Cross trades AND basket Cross trades.


The average price of a stock purchase OR sale is equal to the stock price of each lot multiplied by the share amount, divided by the total share bought OR sold.
*/
===========================================

SEE CHART ATTACHED
Attached Images
File Type: png VWAP EXAMPLE.PNG (85.9 KB, 432 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-07-2010, 06:15 PM
Adheer's Avatar
Adheer Adheer is offline
Regulars
 
Join Date: Apr 2009
Posts: 528
Thanks: 265
Thanked 2,321 Times in 469 Posts
Adheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to beholdAdheer is a splendid one to behold
Default

Quote:
IIf (BarIndex() >= StartBar, VWAP = Sum (C * V, Bars_so_far_today ) / TodayVolume,0);

C x V is not correct for VWAP.
One should not multiply the close of the bar by the volume of the bar. It makes an incorrect assumption that the closing price of the bar is representative of the bar.
What if the maximum trading happened at the high of the bar ?

As I said, if you want accuracy, you would use the Average Traded Price provided by the quotes provider.

The Average Traded Price provided by NSE is the VWAP price - you must use that.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 2 Users Say Thank You to Adheer For This Useful Post:
  #7 (permalink)  
Old 06-07-2010, 06:18 PM
worldastro worldastro is offline
Regular
 
Join Date: Aug 2009
Posts: 92
Thanks: 0
Thanked 30 Times in 25 Posts
worldastro is on a distinguished road
Default

attach chart and afl is defrant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 07-07-2010, 01:44 AM
vidyasagar vidyasagar is offline
Regular
 
Join Date: Jun 2009
Location: Vijayawada (Andhra Pradesh)
Posts: 28
Thanks: 136
Thanked 70 Times in 24 Posts
vidyasagar is on a distinguished roadvidyasagar is on a distinguished road
Default

Average Trading Price = Total Value/Total Volume

here is the AFL for ATP

Vidyasagar
Attached Files
File Type: afl ATP.afl (660 Bytes, 408 views)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to vidyasagar For This Useful Post:
  #9 (permalink)  
Old 05-03-2011, 11:53 PM
jai3222 jai3222 is offline
Regular
 
Join Date: Jun 2009
Posts: 31
Thanks: 56
Thanked 33 Times in 18 Posts
jai3222 is on a distinguished road
Default

Hello,

Did not come across this post earlier. I have a different query on ATP. The link is :

Query on Weighted Close ?

Look forward to some answers.

Regards,

Jai
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to jai3222 For This Useful Post:
Reply

indiTraders - Forum for the Active Indian Trader > Technical > Indicators & Systems


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


RCRT Robo

All times are GMT +5.5. The time now is 08:13 AM.


iT
vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2