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

[amibroker] Re: Index trend coding



PureBytes Links

Trading Reference Links

Brian,
You should first define the individual AND the index Stochastic in 
the timeframes.
Then you may plot them or create the combinatory conditions.
Here is an example:

//Daily and Weekly individual Stochastic
//Definitions
 TimeFrameSet( inDaily ); 
sD = StochD(); 
TimeFrameSet( inWeekly ); 
sW=StochD(); 
TimeFrameRestore(); 
DailyStochD=TimeFrameExpand( sD, inDaily);
WeeklyStochD=TimeFrameExpand(sW,inWeekly);
//Graphs
Plot(DailyStochD, "\nDaily StochD", colorIndigo );
Plot( WeeklyStochD, "Weekly StochD", colorBlue);
//Daily and Weekly index Stochastic
//Definitions
SetForeign("^NDX");
TimeFrameSet( inDaily ); 
sD_index = StochD(); 
TimeFrameSet( inWeekly ); 
sW_index=StochD(); 
TimeFrameRestore(); 
DailyStochD_index=TimeFrameExpand( sD_index, inDaily);
WeeklyStochD_index=TimeFrameExpand(sW_index,inWeekly);
//Graphs
Plot(DailyStochD_index, "\nDaily StochD_index", colorPink ,8);
Plot( WeeklyStochD_index, "Weekly StochD_index", colorDarkRed,8);
//Some conditions
Cond1=DailyStochD<30 AND Cross(WeeklyStochD,WeeklyStochD_index);
PlotShapes(shapeCircle*Cond1,colorYellow);
Cond2=Cross(WeeklyStochD_index,DailyStochD_index) AND DailyStochD>70;
PlotShapes(shapeCircle*Cond2,colorBlack);

I hope it helps.
Dimitris
PS : Above described Cond1, Cond2 are interesting [perhaps] for 
trading signals. Do not put the farm on them, my intension was to 
give a realistic example...

--- In amibroker@xxxxxxxxxxxxxxx, "Brian" <brian@xxxx> wrote:
> Hello everyone,
> 
> Is it possible to build a single exploration that will scan stocks 
> for buy/sell signals AND ALSO at the same time scan an index 
> [using "SetForeign("$SPX")" for example] for other buy/sell signals 
> as well?
> 
> How about if I want the index buy/sell signals to look across 
> multiple timeframes of an indicator (for example, the daily AND the 
> hourly stochastic for the SPX are both below 20 at the same time)?
> 
> What if I want to do all of the above, but with multiple indexes 
> (for example, the SPX and VIX, at the same time)?
> 
> It would be great if someone could throw some sample code for doing 
> this at me. I've tried doing this a few times, and was about to 
take 
> another stab at it, but thought I would ask you folks first. I've 
> been writing code all week, and finally need some help.
> 
> Thanks,
> 
> Bman



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

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/