[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Line of Best Fit and Slope of an MA?



PureBytes Links

Trading Reference Links

Math? What is that? I did the same thing but when my daughter went to 
college I kept her books.

Sure you can use the formula with two different periods and compare 
them. The slope will be cleaner than if you display a longer time 
frame on a shorter period chart using the settimeframe method. And 
when you change time frames you don't have to worry about changing 
the time frame. 

When you are comparing the results with time frame support your base 
chart has the be the shortest time frame. If you want to compare a 1 
and 5 minute slope you have to display the 5 minute data on a 1 
minute chart. If you want to make the time frame switch dynamic you 
can use this approach:

// Time frame calculations
tf = Interval() / 60;
tfp = tf * 180;

StoPer = Param( "Stoch Period", 5, 1, 50, 1 );
Kper = Param( "Stoch %K avg", 3, 1, 20, 1 );
r1 = Param( "MACD Fast", 2, 2, 50, 1 );
r2 = Param( "MACD Slow", 5, 2, 50, 1 );

TimeFrameSet(tfp);
MacdTf = MACD(r1, r2);
tfStoch	= StochK( StoPer, Kper);
TimeFrameRestore();

MacdTfe	= TimeFrameExpand(MacdTf, tfp);
StochTfe = TimeFrameExpand(tfStoch, tfp);

This formula assumes you want to compare a longer time frame that is 
three times the shorter, 1 to 3, 5 to 15, 15 to 45, etc. When you 
plot the longer time frame the expanded MACD will stay the same level 
for three periods. If you use a 20 vs 60 minute period the that won't 
be true. 

Will the results be the same? Good question. When you are using math 
functions like tangent, will the slope be the same with both methods? 
I doubt it. This is especially true if you are using live data. The 
slope may change every time a new tick comes in and that could drive 
you and your program nuts. Compare the results of both methods and 
see if it makes a difference and which gives the best results. 

Barry

--- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@xxx> wrote:
>
> Thanks again, Barry.
> 
> On considering the slope of multiple time frames, could I stay 
within
> the same time frame (e.g. 1-minute chart) and simply compare a 20-
period
> MA and 60-period MA - essentially longer time frames?
> 
> Or should I use the timeframe functions in Amibroker to switch to 
higher
> time frames? In the example above, a 20-period MA on a 1-minute 
chart
> gives me the average over the last 20 minutes. If I instead switch 
to a
> 5-minute chart and compute a 4-period MA, I am looking at the same 
20
> minutes average, no?
> 
> Wish I hadn't thrown out all my old college and high school text 
books.
> I have to wiki even basic math and trig stuff. Amazing how that
> knowledge vanishes if you don't use it for a few years!
> 
> =====================
> Posted through Grouply, the better way
> to access your Yahoo Groups like this one.
> http://www.grouply.com/?code=post
>



------------------------------------

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/