How to handle two time frame AFL? - AmiBroker | futures io social day trading
futures io futures trading


How to handle two time frame AFL?
Updated: Views / Replies:1,727 / 5
Created: by Rainman Attachments:0

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
 
Thread Tools Search this Thread
 

How to handle two time frame AFL?

  #1 (permalink)
Trading Apprentice
Israel
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 3 since Aug 2013
Thanks: 1 given, 0 received

How to handle two time frame AFL?

Hi All,
I'm trying to use TimeFrameCompress & TimeFrameExpand in my AFL.
I looked on couple of examples in AB support zone and code exmaples and from some reason i cannot make this work.

1. I've loaded Tick by Tick Data to AB database and set my basic working time frame to 1Min bars.
2. I want to calc AvgDailyVolume and DailyHHV/LLV using TimeFrameCompress and in my logic to get the last value from each one of them during each 1 min bar closes.

The code looks like -
DVC = TimeFrameCompress(Volume, inDaily);
DailyVolumeAvg = MA(DVC, 30); //calculate on daily time frame

//calculate on basic 1 min time frame
dailyAvgVolume = TimeFrameExpand(DailyVolumeAvg ,inDaily);
Plot( dailyAvgVolume , "dailyAvgVolume", colorYellow, styleOwnScale);

The problem is when i'm examing dailyAvgVolume on the chart with 1Min timeframe i see different results of then in daily timeframe. and the correct value is indeed when setting the chart to daily timeframe.

any idea's what's is wrong with this code?

Reply With Quote
 
  #2 (permalink)
Membership Temporarily Revoked
Zurich/Switzerland
 
Futures Experience: Advanced
Platform: -
Favorite Futures: -
 
Posts: 79 since Oct 2014
Thanks: 0 given, 33 received

It outputs wrong result because it contains incorrect code. You haven't read the entire article of the AmiBroker help file. Since it is Volume array you have to use compressVolume. compressLast is default one if nothing is specified.

 
Code
period = 30;
intradaybars = 1440;
timeframe = inDaily;
expandmode = expandFirst;

SetBarsRequired( period*intradaybars, period*intradaybars );

DVC = TimeFrameCompress(Volume, timeframe, compressVolume);
DailyVolumeAvg = MA(DVC, period); //calculate on daily time frame

//calculate on basic 1 min time frame
dailyAvgVolume = TimeFrameExpand(DailyVolumeAvg, timeframe, expandmode);

Plot( dailyAvgVolume, "dailyAvgVolume", colorYellow, styleOwnScale);

Reply With Quote
The following user says Thank You to prouser for this post:
 
  #3 (permalink)
Trading Apprentice
Israel
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 3 since Aug 2013
Thanks: 1 given, 0 received

How to handle two time frame AFL?


Hi Prouser,
Your reply was very informative and helped me to get some progress.
I've read the entire article but my assumption that 'compressVolume' mode will sum up my volumes and since i needed to calc MA i just got confused and decided to use the default.

I've tried your approach and i still not able so see using Plot() the same values for AvgVol & HHV & LLV when i switch the chart between 1MinBars and DailyBars.

Here is my code -

timeframe = inDaily;
expandmode = expandLast;

DVC = TimeFrameCompress(Volume, timeframe, compressVolume);
DHC = TimeFrameCompress(High, timeframe, compressHigh);
DLC = TimeFrameCompress(Low, timeframe, compressLow);

DAvgVol = TimeFrameExpand(MA(DVC, 30), timeframe, expandmode);
DHHV = TimeFrameExpand(HHV(DHC, 10), timeframe, expandmode);
DLLV = TimeFrameExpand(LLV(DLC, 10), timeframe, expandmode);

as you can see i'm using expandLast and not expandFirst you used in your answer. i changed it because when working with expandFirst i saw specific area's i should get a signal but the system did not found it as such. and i switched to expandLast i got the expected signal.
Having said that, i'd appreciate if you can exaplain the difference between those two modes.

Thanks.

Reply With Quote
 
  #4 (permalink)
Membership Temporarily Revoked
Zurich/Switzerland
 
Futures Experience: Advanced
Platform: -
Favorite Futures: -
 
Posts: 79 since Oct 2014
Thanks: 0 given, 33 received

If I'm using the code of second post I'm getting the same values in 1min compared to setting to daily TF. Not sure what you are doing or seeing.

 
Code
period = 30;
intradaybars = 1440;
timeframe = inDaily;
expandmode = expandFirst;

SetBarsRequired( period*intradaybars, period*intradaybars );

DVC = TimeFrameCompress(Volume, timeframe, compressVolume);
DailyVolumeAvg = MA(DVC, period); //calculate on daily time frame

//calculate on basic 1 min time frame
dailyAvgVolume = TimeFrameExpand(DailyVolumeAvg, timeframe, expandmode);

Plot( dailyAvgVolume, "dailyAvgVolume", colorYellow, styleOwnScale);

dd = Day();

Filter = dd != Ref( dd, -1 ) AND NOT IsNull( dailyAvgVolume);

AddSummaryRows( 63, 1, 4 );
AddTextColumn( Interval(2), "Interval", 1 );
AddColumn( dailyAvgvolume, "DailyAvgVol", 1.0 );
Do you agree that both result lists are showing the same results or are we seeing different things?

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


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




Difference between expanding modes is explained in the help. AFL Function Reference - TIMEFRAMEEXPAND

Basically expandFirst gives the same results as expandLast if using Ref with one bar delay more compared to expandLast (i.e. expandFirst 1 bar delay and expandLast zero delay).

 
Code
period = 30;
intradaybars = 1440;
timeframe = inDaily;
expandmode = expandFirst;
delay = 0;

SetBarsRequired( period*intradaybars, period*intradaybars );

TimeFrameSet( timeframe );
DVC = Ref( MA( V, period ), -delay );
DHC = Ref( HHV( H, 10 ), -delay );
DLC = Ref( LLV( L, 10 ), -delay );
TimeFrameRestore();

DAvgVol = TimeFrameExpand( DVC, timeframe, expandmode );
DHHV = TimeFrameExpand( DHC, timeframe, expandmode );
DLLV = TimeFrameExpand( DLC, timeframe, expandmode );

Plot( DAvgVol, "dailyAvgVolume", colorYellow, styleOwnScale);
Plot( DHHV , "dailyL", colorGreen, styleLine);
Plot( DLLV, "dailyL", colorRed, styleLine);

dd = Day();

Filter = dd != Ref( dd, -1 );

AddSummaryRows( 63, 1.2 );
AddTextColumn( Interval(2), "Interval", 1 );
AddColumn( DAvgVol, "DailyAvgVol", 1.0 );
AddColumn( DHHV, "DailyHHV", 1.2 );
AddColumn( DLLV, "DailyLLV", 1.2 );
Same here. Same results if using expandfirst and zero delay.

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




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





As for your signals. I don't know your entire code so can't know what you are doing wrong there.


Last edited by prouser; March 10th, 2015 at 10:05 AM.
Reply With Quote
 
  #5 (permalink)
Trading Apprentice
Israel
 
Futures Experience: Beginner
Platform: TradeStation
Favorite Futures: Futures
 
Posts: 3 since Aug 2013
Thanks: 1 given, 0 received

How to handle two time frame AFL?

I'll learn your code and implemented it and using the AddColumn will verify i indeed seeing the same results.
Thank you for the detailed reply.

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
NGP MS India
 
Futures Experience: Intermediate
Platform: meta trader / ninja trader
Favorite Futures: futures
 
Posts: 16 since May 2015
Thanks: 26 given, 2 received


Rainman View Post
I'll learn your code and implemented it and using the AddColumn will verify i indeed seeing the same results.
Thank you for the detailed reply.

any success? i tried but could not get the desired results.

Reply With Quote

Reply



futures io > > > > How to handle two time frame AFL?

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
Candle time breakout AFL. mt4eas AmiBroker 0 September 11th, 2014 03:37 AM
Standard indicator of higher time frame plotted on smaller time frame? BarOne NinjaTrader 3 April 21st, 2013 11:21 AM
What is your principle time frame? wldman Traders Hideout 12 January 8th, 2013 12:47 PM
time frame ness1g Traders Hideout 10 February 8th, 2012 10:43 AM
Time of day,and possible time frame sycronization phasganon The Elite Circle 1 September 24th, 2011 12:53 AM


All times are GMT -4. The time now is 04:35 PM.

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-18 in 0.12 seconds with 20 queries on phoenix via your IP 54.221.136.62