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

Re: [amibroker] Re: Plugin dll



PureBytes Links

Trading Reference Links

Dear Stephane,

The documentation you are asking for will be a part
of upcoming ADK (AmiBroker Development Kit).

I am writing it currently.

BTW: One thing I can not understand is why writing documentation
is slower than coding :-)))

Best regards,
Tomasz Janeczko
amibroker.com

----- Original Message -----
From: "Stephane Carrasset" <nenapacwanfr@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Monday, November 12, 2001 2:12 PM
Subject: [amibroker] Re: Plugin dll


> Tomacz,
>
> Thanks,
> Do you think, you'll write a Help file for plugin's dlls.
> or as I wrote , you'll provide some more examples.
>
> stephane
> >
> > Please note that O, H, L, C, OI variables are available
> > directly to the DLL (no need for passing them as arguments):
> >
> > void GetStockArrays( struct StockArrays *sa )
> > {
> > Size = gSite.GetArraySize();
> > Open = gSite.GetStockArray( 0 );
> > High = gSite.GetStockArray( 1 );
> > Low = gSite.GetStockArray( 2 );
> > Close = gSite.GetStockArray( 3 );
> > Volume = gSite.GetStockArray( 4 );
> > }
> >
> > Best regards,
> > Tomasz Janeczko
> > amibroker.com
> >
> > ----- Original Message -----
> > From: <cliffelion@xxxx>
> > To: <amibroker@xxxx>
> > Sent: Monday, November 12, 2001 3:19 AM
> > Subject: [amibroker] Re: Plugin dll
> >
> >
> > > HI Stephanie,
> > >
> > > Maybe this will help??
> > > It is a calculation of Wilders Swing Index ... takes O/H/L/C
> arrays
> > > as input. See in 'FunctionTag gFunctionTable[]' below that the
> number
> > > of arrays is defined as 4.... then you can access each array byu
> > > their index [ .. ].
> > >
> > > Cliff Elion
> > >
> > >
> > >
> > > AmiVar SI_si( int NumArgs, AmiVar *ArgsTable )
> > > {
> > > int i, j, L1;
> > > double si, K1, R1, R2, R3, R;
> > > AmiVar result;
> > >
> > > result = gSite.AllocArrayResult();
> > >
> > > int nSize = gSite.GetArraySize();
> > > int nLookBack = 1; file://number of
> > > lookback bars in function
> > >
> > > float *O = ArgsTable[ 0 ].array;
> > > float *H = ArgsTable[ 1 ].array;
> > > float *L = ArgsTable[ 2 ].array;
> > > float *C = ArgsTable[ 3 ].array;
> > >
> > > j = SkipEmptyValues( nSize, C, result.array );
> > >
> > > L1 = 3;
> > >
> > > for( i = j; i < nSize; i++ )
> > > {
> > > if(i<(j+nLookBack)) {result.array[i] =
> > > EMPTY_VAL;continue;}
> > >
> > > K1 = max ( fabs( H[i] - C[i-1] ), fabs( L[i] - C[i-
> > > 1] ) );
> > > R1 = fabs ( H[i] - C[i-1] );
> > > R2 = fabs ( L[i] - C[i-1] );
> > > R3 = fabs ( H[i] - L[i] );
> > >
> > > if ( (R1 > R2) & (R1 > R3) )
> > > R = fabs(H[i]-C[i-1])-.5*fabs(L[i]-C[i-1])
> > > +.25*fabs(C[i-1]-O[i-1]);
> > > else if ( (R2 > R1) & (R2 > R3) )
> > > R = fabs(L[i]-C[i-1])-.5*fabs(H[i]-C[i-1])
> > > +.25*fabs(C[i-1]-O[i-1]);
> > > else if ( (R3 > R1) & (R3 > R2) )
> > > R = fabs(H[i]-L[i])+.25*fabs(C[i-1]-O[i-1]);
> > >
> > > si = C[i]-C[i-1] + 0.5*(C[i]-O[i]) + 0.25*(C[i-1]-O[i-
> > > 1]);
> > > si = (50 * si / R) * (K1/L1);
> > >
> > > result.array[i] = (float) si;
> > > }
> > > return result;
> > > }
> > >
> > >
> > > FunctionTag gFunctionTable[] = {
> > >
> > > "SI", { SI_si, 4, 0, 0, 0, NULL },
> > >
> > > "SI_System", { SI_System, 4, 0, 2, 0, NULL }
> > > };
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > --- In amibroker@xxxx, "Stephane Carrasset" <nenapacwanfr@xxxx>
> wrote:
> > > > Tomacz,
> > > >
> > > > is it possible that you give us some more example of plugin
> dlls,
> > > > today I want to write a dll with two "arrays"
> > > > myatr(array, K)
> > > > where array is close ot low or..
> > > > and K is a numeric value in fact an atr value.
> > > >
> > > > with the relation below :
> > > >
> > > > (float) stop ;
> > > > if(L[i] < prev1)
> > > > (float) stop= SrcArray[i] - k ;
> > > > else
> > > > (float) stop= prev1;
> > > > if((SrcArray[i] - k) > prev2)
> > > > (float) stop= SrcArray[i] - k;
> > > > else
> > > > (float) stop=prev3;
> > > >
> > > >
> > > >
> > > > /******************full code**************************/
> > > > AmiVar VMyAtr( int NumArgs, AmiVar *ArgsTable )
> > > > {
> > > > int i,j,k;
> > > > float prev1,prev2,prev3,stop;
> > > > AmiVar result;
> > > >
> > > > result = gSite.AllocArrayResult();
> > > >
> > > > int nSize = gSite.GetArraySize();
> > > >
> > > > float *L = ArgsTable[ 0 ].array;
> > > > float *SrcArray = ArgsTable[ 1 ].array;
> > > >
> > > > int nRange = (int) ArgsTable[ 1 ].val;
> > > >
> > > > j = SkipEmptyValues( nSize, SrcArray, result.array );
> > > >
> > > > for( i = j; i < nSize; i++ )
> > > > {
> > > > ////////////////////////////
> > > > // check if there is enough data to calculate average
> > > > // skip elsewhere
> > > > ////////////////////////////
> > > > if( i < j + nRange )
> > > > {
> > > > result.array[ i ] = EMPTY_VAL;
> > > > continue;
> > > > }
> > > > for( k = 0; k < nRange; k++ )
> > > > ////////////////////////////////
> > > > // calculate Stop
> > > > ////////////////////////////////
> > > > {
> > > > prev1=0;
> > > > prev2=0;
> > > > prev3=0;
> > > >
> > > > (float) stop ;
> > > > if(L[i] < prev1)
> > > > (float) stop= SrcArray[i] - k ;
> > > > else
> > > > (float) stop= prev1;
> > > > if((SrcArray[i] - k) > prev2)
> > > > (float) stop= SrcArray[i] - k;
> > > > else
> > > > (float) stop=prev3;
> > > >
> > > > prev3 = prev2;
> > > > prev2 = prev1;
> > > > prev1 = stop;
> > > > }
> > > > /////////////////////////////////
> > > > result.array[ i ] = (float) stop;
> > > > }
> > > > return result;
> > > > }
> > >
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> > >
> > >
> > >
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>