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

[amibroker] InLine Composites



PureBytes Links

Trading Reference Links

Perhaps someone is willing to verify/compare/improve this code with the AddToComposite() for general use:

WLNum			= Param("WatchList Number",9,0,64,1);
TickerList 	= StaticVarGetText("WLTickerList");
TickerList	= CategoryGetSymbols( categoryWatchlist, WLNum );

for( T = 0, Ox=Hx=Lx=Cx=Vx=0; ( symbol = StrExtract( TickerList, T ) ) != ""; T++ )
	{
	SetForeign( Symbol );
	Ox = Ox + IIf(Nz(O), Nz(O),0);
	Hx = Hx + IIf(Nz(O), Nz(H),0);
	Lx = Lx + IIf(Nz(O), Nz(L),0);
	Cx = Cx + IIf(Nz(O), Nz(C),0);
	VX = Vx + IIf(Nz(O), 1,0);
	RestorePriceArrays();
	}
Ox=Ox/VX;
Hx=Hx/VX;
Lx=Lx/VX;
Cx=Cx/VX;

PlotOHLC(Ox,Hx,Lx,Cx,"Raw WL Comp",6,128);


Best regards,
herman

Thursday, January 25, 2007, 8:39:33 AM, you wrote:

> Hi,
> Is there any way to create a composite from the indicator window?
> I'am trying to create a trailing stop. If a new signal is found while 
> in the trade, I want to change the stop to that signal if it's lower/
> higher than the previous one:
> StopPS1= StaticVarGet("ShortTrailing") +(R);
> AddToComposite(StopPS1, "~~Trail", "C");

> Works if I run scan, but does not seem to work adding new signals to 
> the composite as they appear.
> Thanks in advance,
> Jerry

> --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxx> wrote:

>> Herman,

>>  

>> I remember reading about this in the 4.89.0 beta release notes. 
> Presumably
>> your flags are set correctly and you have 4.80.0? 

>>  

>> This is from the release notes:

>> Added ability to create composites (using AddToComposite) inside 
> indicator
>> code via new atcFlagEnableInIndicator flag (FC#: 191)

>> --

>> Terry

>> -----Original Message-----
>> From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
> On Behalf
>> Of Herman
>> Sent: Saturday, January 20, 2007 13:44
>> To: AmiBroker YahooGroups
>> Subject: [amibroker] Static/Persistent Arrays

>>  

>> I would like to use Composites to create Static (Persistent) 
> arrays, why
>> doesn't this work from an indicator?

>> Sometimes it works, sometimes it accumulates values, sometimes I 
> need to
>> click APPLY, and sometimes it just stores the last value.

>> thanks,

>> herman

>> SaveComp = ParamTrigger("Save Composite","SAVE");

>> ClearComp = ParamTrigger("Clear Composite","CLEAR");

>> if( SaveComp) 

>> {

>> AddToComposite(C,"~Test123","X",atcFlagDeleteValues|
> atcFlagCompositeGroup|at
>> cFlagEnableInIndicator);

>> }

>> else if( ClearComp) 

>> {

>> AddToComposite(0,"~Test123","X",atcFlagDeleteValues|
> atcFlagCompositeGroup|at
>> cFlagEnableInIndicator);

>> }

>> Plot(C,"",1,128);

>> Cx = Foreign("~Test123","x");

>> Plot(Cx,"",4,1);





> 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




Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.9/650 - Release Date: 1/24/2007 4:06 PM