indiTraders - Forum for the Active Indian Trader  

Go Back   indiTraders - Forum for the Active Indian Trader > Tools > Software > Tradestation

DPonline
Reply
 
Bookmark and Share LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 16-02-2014, 10:19 AM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,087
Thanks: 7,912
Thanked 2,313 Times in 1,380 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default VWAP --- swing strategy

Hi

can anyone convert it to AFL ?


PHP Code:
inputtime_start (0930), time_end (1615), upColor(Cyan), dnColor(Magenta);

varsvwap(0),
pv(0),
Totalvolume(0),
Barfromstart(0),
Squareddeviations(0),
Probabilityweighteddeviations(0),
deviationsum(0),

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


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 
value10 to Barfromstart
begin
Squareddeviations
=Squarevwap-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[1then var1 upColor;
if 
vwap vwap[1then var1 dnColor;
SetPlotColor(1,var1); 
Thanks
n-tuple
(credit goes to original author Ref from BMT)
Attached Images
File Type: jpg 20130523-n1b2-257kb.jpg (258.0 KB, 58 views)
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.

Last edited by nTP; 16-02-2014 at 01:37 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 18-02-2014, 11:34 AM
AmiSmart AmiSmart is offline
Regular
 
Join Date: Sep 2013
Posts: 53
Thanks: 2
Thanked 79 Times in 37 Posts
AmiSmart is on a distinguished roadAmiSmart is on a distinguished road
Default

Originally Posted by n-tuple View Post
Hi

can anyone convert it to AFL ?


Try this.

PHP Code:
time_start ParamTime("Time Start""09:30");
time_end   ParamTime("Time End""16:15");
time_range ParamColor("Time Range",ColorRGB(11,11,11));

UpColorParamColor("WVap's Up Color",colorAqua);
DnColorParamColor("WVap's Dn Color",ColorRGB(255,0,255));

//////////////// Am.I.Smart ? ////////////////
TimeRange TimeNum() >= time_start AND TimeNum() <= time_end;
RangeStartBar TimeNum() >= time_start ;
RangeStartBar RangeStartBar Ref(RangeStartBar,-1);

AvgPrice Avg;
PV AvgPrice TimeRange;

BarsInRange = (BarsSince(RangeStartBar)) * TimeRange;
TotalVolume Sum(V,BarsInRange);


VWAP Sum(PVBarsInRange ) / TotalVolume;

DevSum Sum((VWAP-AvgPrice)^2,BarsInRange) / BarsInRange;   //deviationsum
SD sqrt(DevSum); //StandardDeviation

Clr IIf(Vwap>Ref(Vwap, -1), UpColorIIf(Vwap<Ref(Vwap, -1), DnColorcolorYellow));

//////////////// Am.I.Really.Smart ? ////////////////

Plot(IIf(VWAP,VWAP,       Null), "\nVWAP",ClrstyleNoLabel|styleThick);
Plot(IIf(VWAP,VWAP SD,  Null), "\n+1SD"ParamColor("Color +1SD"ColorRGB(238,174,238)));
Plot(IIf(VWAP,VWAP SD,  Null), "\n-1SD"ParamColor("Color -1SD"ColorRGB(210,180,140)));
Plot(IIf(VWAP,VWAP 2*SD,Null), "\n+2SD"ParamColor("Color +2SD"ColorRGB(153,102,204)));
Plot(IIf(VWAP,VWAP 2*SD,Null), "\n-2SD"ParamColor("Color -2SD"ColorRGB(238,154,73)));
Plot(IIf(VWAP,VWAP 3*SD,Null), "\n+3SD"ParamColor("Color +3SD"ColorRGB(128,0,128)));
Plot(IIf(VWAP,VWAP 3*SD,Null), "\n-3SD"ParamColor("Color -3SD"ColorRGB(238,118,33)));

Plot(TimeRange""time_rangestyleArea|styleOwnScaleNullNull0, -5); 

Last edited by AmiSmart; 18-02-2014 at 11:37 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following 4 Users Say Thank You to AmiSmart For This Useful Post:
  #3 (permalink)  
Old 18-02-2014, 01:43 PM
kkseal kkseal is offline
Hip-py
 
Join Date: Apr 2009
Posts: 4,909
Thanks: 6,508
Thanked 9,445 Times in 4,056 Posts
kkseal has a reputation beyond reputekkseal has a reputation beyond repute
kkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond reputekkseal has a reputation beyond repute
Default

Not the same Stuff omitted.
__________________
'Growth & Value are joined at the hip' - Warren buffet
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
The Following User Says Thank You to kkseal For This Useful Post:
  #4 (permalink)  
Old 18-02-2014, 10:06 PM
nTP's Avatar
nTP nTP is offline
Flash Crash
 
Join Date: Dec 2013
Location: kolkata
Posts: 2,087
Thanks: 7,912
Thanked 2,313 Times in 1,380 Posts
nTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud ofnTP has much to be proud of
Default

hi
AMI

Originally Posted by kkseal View Post
Not the same Stuff omitted.

not the same staff as in the pic.
__________________
thx
nTuple

Disclaimer: I am not a Research Analyst and not registered with any regulating authority. All posts are for educational purpose only.

Consider us a dumb -dumble guy in this analysis, any type of real time example will be quick-learn approach.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 19-02-2014, 03:45 AM
AmiSmart AmiSmart is offline
Regular
 
Join Date: Sep 2013
Posts: 53
Thanks: 2
Thanked 79 Times in 37 Posts
AmiSmart is on a distinguished roadAmiSmart is on a distinguished road
Default

Originally Posted by n-tuple View Post
hi
AMI



not the same staff as in the pic.


If you try and not the same, i cannot help at this moment.
The TS not that easy, take time to do it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

indiTraders - Forum for the Active Indian Trader > Tools > Software > Tradestation


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


DPonline

All times are GMT +5.5. The time now is 02:59 PM.


vBulletin Copyright by vBulletin

Content Relevant URLs by vBSEO 3.3.2