Simple Coding Help - No Promise.

asnavale

Well-Known Member
Pls Make Current VWAP + Yestvwap + 2 days vwap Amibroker AFL
thnks in advance
A small clarification required. Do you need VWAP of last three days, last two days and today separately as three different lines or three VWAP lines for one day duration but continue on the next days as a straight line with last value of VWAP of that day.. What I mean is:

In first case:
1) calculate VWAP starting from two days back and continue till today end and plot it as one curve
2) calculate VWAP starting from yesterday, continue till todays end and plot a second curve.
3) calculate VWAP starting from today beginning till today end and plot third curve.

In second case:
1) calculate VWAP starting two days back and till that days end only, plot the curve and continue the line till today end as a straight line
2) calculate VWAP beginning yesterday and till yesterday end only and plot it to continue today as straight line.
3) calculate VWAP beginning today and till today end plot it today.

If what I am asking is not clear, please let me know. I will put a chart to clarify the two cases.

-Anant
 

yusi

Well-Known Member
Any AFL for top gainers in EOD data where we can put specific dates .
for example top gainers from 10 Sep 2019 etc.
C-like:
//Input two dates, give difference in price between first and last date
//Daily charts
//Change filter to suit

startDateTime = ParamDate("Start Date", "2019-01-01", 2);
endDateTime = ParamDate("End Date", "2019-06-30", 2);

valueStart = Lookup(Open, startDateTime, 1); // return exact or successor
valueEnd = Lookup(Close, endDateTime, -1); //return exact or previous
valueDiffPercent = 100 * (valueEnd - valueStart) / valueStart;

Filter = valueEnd > 20 AND valueEnd * Volume > 500000;

AddColumn(startDateTime, "Start Date", formatDateTime);
AddColumn(endDateTime, "End Date", formatDateTime);
AddColumn(valueStart, "Start Value", 1.2);
AddColumn(valueEnd, "End Value", 1.2);
AddColumn(valueDiffPercent, "% diff", 1.0, colorDefault, IIf(valueDiffPercent >= 0, colorAqua, colorPink));
 
Last edited:

TraderRavi

low risk profile
C-like:
//Input two dates, give difference in price between first and last date
//Daily charts
//Change filter to suit

startDateTime = ParamDate("Start Date", "2019-01-01", 2);
endDateTime = ParamDate("End Date", "2019-06-30", 2);

valueStart = Lookup(Open, startDateTime, 1); // return exact or successor
valueEnd = Lookup(Close, endDateTime, -1); //return exact or previous
valueDiffPercent = 100 * (valueEnd - valueStart) / valueStart;

Filter = valueEnd > 20 AND valueEnd * Volume > 500000;

AddColumn(startDateTime, "Start Date", formatDateTime);
AddColumn(endDateTime, "End Date", formatDateTime);
AddColumn(valueStart, "Start Value", 1.2);
AddColumn(valueEnd, "End Value", 1.2);
AddColumn(valueDiffPercent, "% diff", 1.0, colorDefault, IIf(valueDiffPercent >= 0, colorAqua, colorPink));
4 errors coming Sir , while scanning.

ScreenHunter_878 Oct. 03 18.46.jpg
 
What does your Ami help file say for the Lookup function. Mine says:

looks like both the versions using same AFL 3.40, but interpreting differently

@TraderRavi use

StrToDateTime(startDateTime) in place of startDateTime
StrToDateTime(endDateTime) in place of endDateTime

for first two errors

and

AddTextColumn in place of in AddColumn

on last two errors

.
 

Similar threads