Simple Coding Help - No Promise.

In the AFL, try this

TimeFrameSet(inHourly);
// Code for Moving Average like this
Plot( MA( CLOSE, 12 ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
TimeFrameRestore();
@travi , Hw r u ? been a while.:)

1. @myth.goa may meant he is using EOD for Daily Charts and Obviously Not Possible to Compress to a TF (Hourly) lower than the Base TF (Daily, EOD ) of the Data.

2. TimeFrameExpand() is required.

travi sir,
Thanks for Reply.
It plots daily MA only. I tried even changing time frames, but no use.
 

travi

Well-Known Member
@LOVEENAJYOTHI I'm Fine thank you, hope your trading is going on well.

@myth.goa
The code example I've used is supposed to work, the only thing I missed is the following. Thanks To Loveenajyothi I read a bit and figured this out.

When calculating on lower TF and plotting on higher TF, you need TimeFrameCompress.
But in your case its the other way so you need this line instead of my original post.

Try this code
///////////
TimeFrameSet(inHourly);
// MA in Hr TF for 12 bars
mah_12 = MA( C, 12 );
TimeFrameRestore();

Plot( Close, "Price", colorWhite, styleCandle );
Plot( TimeFrameExpand( mah_12, inHourly), "12 bar moving average from Hourly bars", colorRed); // this is the million dollar trick :D

///////////
Infact you can add multiple such blocks of TF and plot various MA from different TF on your daily chart.
 
Last edited:

john302928

Well-Known Member
Hi could any one help me with this below requirement
I want to add volumes of number of days set in analysis window. say i have 1 oct 2017 to 30 oct 2017 and it should add all those 30 days of volume.

Thanks in advance
 
Last edited:

travi

Well-Known Member
Hi could any one help me with this below requirement
I want to add volumes of number of days set in analysis window. say i have 1 oct 2017 to 30 oct 2017 and it should add all those 30 days of volume.

Thanks in advance
Not very clear but add this to your code
// This line at the top which gives you a list of periods, Default is 30
VolP = ParamList("Vol Period","5|10|20|30|50",3);

//Somewhere near the end of your code. It will Add the Volume. Make sure the Volume variable references correctly to the scrip in action in your code
AddColumn( sum(Volume, VolP),"Total Vol",1.0);
 

john302928

Well-Known Member
Not very clear but add this to your code
// This line at the top which gives you a list of periods, Default is 30
VolP = ParamList("Vol Period","5|10|20|30|50",3);

//Somewhere near the end of your code. It will Add the Volume. Make sure the Volume variable references correctly to the scrip in action in your code
AddColumn( sum(Volume, VolP),"Total Vol",1.0);
Thank you travi,
But I want the total volume for the set ranges in analysis window. in the below snapshot i have set 1 oct to 26 oct. so it should automatically add volumes from 1 oct to 26 oct. and if i change the range as 24 oct to 27 oct then it should show the total volume from 24 th oct to 27 oct. Hope you get my point
upload_2017-10-30_12-30-38.png
 

travi

Well-Known Member
Thank you travi,
But I want the total volume for the set ranges in analysis window. in the below snapshot i have set 1 oct to 26 oct. so it should automatically add volumes from 1 oct to 26 oct. and if i change the range as 24 oct to 27 oct then it should show the total volume from 24 th oct to 27 oct. Hope you get my point
I don't yet know how to programmatically access the range fields defined through AFL.
Ideally, you should access the from and to dates, subtract them and get the number of bars in the range as per the TF (say daily in your case).
The variable VolP should be populated with that result.

you can use the AddColumn line I've posted and the rest should work.

The crude way is to still add the AFL code I posted and you can manually assign the variable
VolP=30; // Subtract the dates and put that result in the AFL
 
Hi could any one help me with this below requirement
I want to add volumes of number of days set in analysis window. say i have 1 oct 2017 to 30 oct 2017 and it should add all those 30 days of volume.

Thanks in advance
Go to the Amibroker forum and you will get an answer. But they only answer if you make some effort to show you tried to solve the problem . They don't answer if you just leave a vague question.

Also they seem to be mostly English speaking world and do NOT like when Indian traders use slang like "Scrip". Gets them mad. They use "symbol", "stock", "ticker", "security" etc.
 
Go to the Amibroker forum and you will get an answer. But they only answer if you make some effort to show you tried to solve the problem . They don't answer if you just leave a vague question.

Also they seem to be mostly English speaking world and do NOT like when Indian traders use slang like "Scrip". Gets them mad. They use "symbol", "stock", "ticker", "security" etc.
Thank you @AmiFan for bringing this up.

No
they DO NOT get mad when you use "Scrip" ,
Rather they may (but Not so far) get mad if you use "Script" instead of "Scrip".
"Scrip" is NOT Slang, IT IS as Standard & Authentic as "symbol", "stock", "ticker" or "security.
But "Script" is WRONG USAGE for "symbol", "stock", "ticker" or "security.

Thank you , Regards.
 

Similar threads