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

[amibroker] Re: [for GARY] Foreign() in TimeFrames question



PureBytes Links

Trading Reference Links

I don't know if this will help, but I have had some luck working in 
multiple time frames when I create a separate array variable for the 
expansion of the higher timeframe (daily in this case) before the 
timeframerestore() call, like so:  

// Working with 1 minute database, pick any current stock

CForeignMin= Foreign(Name(),"C");
CCurrentMin= C;
 
TimeFrameSet(inDaily);

CForeignDaily= Foreign(Name(),"C");
EXPcfd = TimeFrameExpand(CCurrentDaily,inDaily) ;
CCurrentDaily= C;
EXPccd = TimeFrameExpand(CForeignDaily,inDaily) ;

TimeFrameRestore();


Plot(CCurrentMin,"CCurrentMin",2,1); // origional 1 minutes
Plot( EXPcfd ,"CCurrentDaily",7,1);

Plot(CForeignMin,"CForeignMin",1,1); // origional 1 minutes
Plot( EXPccd ,"CForeignDaily",6,1);

Also, I have had very strange results WITHOUT the "expandFirst" 
argument, so I have had to use that.  But I'm not sure what you are 
trying to do.  My purpose was to improve a channel breakout system by 
maintaining the low whipsaw of, say, 20 min. channel lines, while 
improving the price when buying the close of a bar crossing the 
channel line, by using a shorter time frame for the bars, say, 5 
min.  For this purpose the "expandFirst" argument did the trick.

But I am new to Amibroker, so I apologize if this is all mistaken.  
BTW, your essay on optimization is really great, thanks.











--- In amibroker@xxxxxxxxxxxxxxx, "Herman van den Bergen" 
<psytek@xxxx> wrote:
> Hi Gary,
> 
> I am still struggling with my Foreign problem, would you be willing 
to help
> me out once more? Clould you copy the code below in an indicator 
and apply
> it, use any stock you like. Do you see anything wrong with my code? 
I cannot
> get the Foreign() to work properly. See the Blue line below? That 
is what I
> get when i use minute prices retrieved with Foreign() and switch 
the to the
> Daily TimeFrame. Your help is much appreciated!
> herman.
> 
> 
> 
> // Working with 1 minute database, pick any current stock
> TimeFrameSet(in1Minute); // redundent...
> CForeignMin= Foreign(Name(),"C");
> CCurrentMin= C;
> 
> TimeFrameSet(inDaily);
> CForeignDaily= Foreign(Name(),"C");
> CCurrentDaily= C;
> 
> TimeFrameRestore();
> 
> Plot(CCurrentMin,"CCurrentMin",2,1); // origional 1 minutes
> Plot(TimeFrameExpand(CCurrentDaily,inDaily),"CCurrentDaily",7,1);
> 
> Plot(CForeignMin,"CForeignMin",1,1); // origional 1 minutes
> Plot(TimeFrameExpand(CForeignDaily,inDaily),"CForeignDaily",6,1);
> 
> 
> 
> 
> 
> 
>   -----Original Message-----
>   From: Gary A. Serkhoshian [mailto:serkhoshian777@x...]
>   Sent: Monday, May 10, 2004 9:15 PM
>   To: amibroker@xxxxxxxxxxxxxxx
>   Subject: Re: [amibroker] Foreign() in TimeFrames question
> 
> 
>   Herman,
> 
>   I ran your code with ES #F (don't have QQQ), and it
>   ran perfectly in 1 min and daily.
> 
>   Regards,
>   Gary
> 
> 
>   --- Herman van den Bergen <psytek@xxxx> wrote:
>   > Can somebody explain how to use Foreign() and/or
>   > SetForeign() in Time
>   > Frames?
>   >
>   > We setting the current stock to the QQQ and setting
>   > AA Periodicity to Daily
>   > the code below gives expected results with and
>   > without the Foreign()
>   > statement. However when setting my AA Periodicity to
>   > 1Minute the system
>   > doesn't seem to work.
>   >
>   > Can Foreign() and SetForeign() be used within
>   > TimeFrames?
>   >
>   > Thanks for any help you can give!
>   > herman.
>   >
>   >
>   >
>   ------------------------------------------------------------------
--------
> --
>   > ----
>   >
>   > TimeFrameSet(inDaily);
>   > SetForeign("QQQ"); // <<<<<<<<<<<<<<<<<<<
>   > Buy=Cross( MACD(), Signal() );
>   > Sell = Cross( Signal(), MACD() );
>   > TimeFrameRestore();
>   > Buy=TimeFrameExpand(Buy,inDaily);
>   > Sell=TimeFrameExpand(Sell,inDaily);
>   > Short=Sell;
>   > Cover=Buy;
>   >
>   >
>   ------------------------------------------------------------------
--------
> --
>   > ----
>   >
>   >
>   >
> 
> 
> 
> 
> 
>   __________________________________
>   Do you Yahoo!?
>   Win a $20,000 Career Makeover at Yahoo! HotJobs
>   http://hotjobs.sweepstakes.yahoo.com/careermakeover
> 
> 
>   Send BUG REPORTS to bugs@xxxx
>   Send SUGGESTIONS to suggest@xxxx
>   -----------------------------------------
>   Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
>   (Web page: http://groups.yahoo.com/group/amiquote/messages/)
>   --------------------------------------------
>   Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> 
>         Yahoo! Groups Sponsor
>               ADVERTISEMENT
> 
> 
> 
> 
> 
> --------------------------------------------------------------------
--------
> --
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
> 
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
> 
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.




Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/