PureBytes Links
Trading Reference Links
|
sure you can switch on strings. i have done it in ruby. i think i may
have done it in vb6 but not sure
--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Can you do switch statements on strings? I haven't tried that in
AFL.
> But, I've never seen string support in the many other languages
that
> I've done coding in.
>
> Mike
>
> --- In amibroker@xxxxxxxxxxxxxxx, "murthysuresh" <money@> wrote:
> >
> > i cannot find where the syntax error is. it points to the end of
> the
> > code. i cannot find it to fix it. pl help
> >
> >
> > SetChartOptions(0,chartShowArrows|chartShowDates);
> > _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g,
Hi %
> > g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue
(
> > ROC( C, 1 ) ) ));
> > Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle
|
> > ParamStyle("Style") | GetPriceStyle() );
> > //_TRACE("ABTest: test trace1 ");
> >
> > //#include "C:\Program
> > Files\AmiBroker\sharedLibrary\DateTimeToNumber.afl"
> >
> >
> > StaticVarSetText( "TradeType" , "Stocks" ); //Stocks|Forex
> > StaticVarSetText( "forexSymbol" , "SBUX" ); //"EUR.USD-IDEALPRO-
> CASH|
> > StaticVarSetText( "StockSymbol", "SBUX" ); // "YHOO"
> > StaticVarSetText( "ShortOrLong" , "Long" ); //"Short|Long"
> > StaticVarSetText( "EntryPrice" , "14.5,15.5" );
> > StaticVarSetText( "ExitPrice" , "14.3" );
> > StaticVarSetText( "EntryDate" , "1080715,1080723" );
> > StaticVarSetText( "ExitDate", "1080725" );
> > StaticVarSetText( "EntryTime", "13:19:45,12:19:12" );
> > //StaticVarSet( "ExitTime" ,Time_To_Num("17:52:17"));
> >
> >
> > StaticVarSet( "NoOfEntries" , 2 );
> > StaticVarSet( "NoOfExits" , 1 );
> >
> >
> >
> >
> >
> >
> >
> > function returnBarIndex( array )
> > {
> > indx = -1;
> >
> > for ( i = 1; i < BarCount;i++ )
> > {
> >
> > if ( array[i] == True )
> > {
> > indx = i;
> > }
> > }
> >
> > return indx;
> > }
> >
> >
> >
> > function returnShiftedArray( array, shift )
> > {
> >
> >
> > newArray = array;
> >
> > for ( i = 1; i < BarCount;i++ )
> > {
> >
> > if ( ( array[i] == True ) && ( ( shift + i ) >= 0 ) && (
(
> > shift + i ) < BarCount ) )
> > {
> >
> > newArray[shift+i] = True;
> > newArray[i] = False;
> >
> >
> > }
> > }
> >
> >
> > return newArray;
> > }
> >
> > // get the static variables
> >
> > TradeType = StaticVarGetText( "TradeType" );
> > forexSymbol = StaticVarGetText( "forexSymbol" );
> > StockSymbol = StaticVarGetText( "StockSymbol" );
> > ShortOrLong = StaticVarGetText( "ShortOrLong" );
> >
> > ExitPrice = StaticVarGet( "ExitPrice" );// obsolete
> >
> >
> >
> > ExitDate = StaticVarGet( "ExitDate" );// obsolete
> >
> >
> >
> > ExitTime = StaticVarGet( "NoOfEntries" );// obsolete
> >
> > for ( i = 0 ;i <= StaticVarGet( "NoOfEntries" ) ;i++ )
> > {
> > VarSet( "EntryDate"+(i-1), StrToNum(StrExtract
> > (StaticVarGetText("ExitDate"), (i-1) )) );
> > }
> >
> > for ( i = 0 ;i <= StaticVarGet( "NoOfExits" ) ;i++ )
> > {
> > VarSet( "ExitDate"+(i-1), StrToNum(StrExtract(StaticVarGetText
> > ("ExitDate"), (i-1) )) );
> > }
> >
> > Buy = Sell = Short = Cover = entry=entryPrices=exitPrices=False;
> >
> > if ( TradeType == "Stocks" )
> > {
> > stockname = stockSymbol;
> >
> > SetOption( "FuturesMode", False );
> > }
> > else
> > {
> > stockname = forexSymbol;
> > SetOption( "FuturesMode", True );
> >
> > }
> > if(Name()==STOCKNAME ){
> > dn=DateNum();
> > switch ( Interval() )
> > {
> >
> >
> > case inDaily:
> >
> > for (b=0;b<BarCount;b++){
> >
> > for ( i = 0 ;i <= StaticVarGet( "NoOfEntries" )-
> > 1 ;i++ )
> > {
> > if(dn[b]== VarGet( "EntryDate"+i)){
> >
> > entryPrices[b]=VarGet
> > ( "EntryPrice"+i);
> >
> > PlotText( "entry"
> > +VarGet( "EntryPrice"+i) ,b,VarGet( "EntryPrice"+i)
+1,colorBlue );
> >
> > }
> >
> > for ( j = 0 ;j <= StaticVarGet( "NoOfExits" )-
> > 1 ;j++ )
> > {
> > if(dn[b]== VarGet( "ExitDate"+j)){
> >
> > entryPrices[b]=VarGet
> > ( "ExitPrice"+j);
> >
> > PlotText( "Closure"
> > +VarGet( "ExitPrice"+j) ,b,VarGet( "ExitPrice"+j)+1,colorRed);
> >
> > }
> >
> >
> >
> >
> > }
> >
> > /*
> > if(dn[b]==EntryDate0)
> > Buy[b]=True;
> > entryPrices[b]=EntryPrice0;
> >
> > if(dn[b]==EntryDate1){
> > Buy[b]=True;
> > entryPrices[b]=EntryPrice1;
> > PlotText( "entry"
> > +EntryPrice1 ,b,EntryPrice1,colorBlue );
> >
> > }*/
> > }
> > // entry =Name() == STOCKNAME AND ((BarIndex() = ValueWhen(
> DateNum
> > () == EntryDate0 , BarIndex() );
> > //entry=Name()==STOCKNAME AND ((BarIndex()==ValueWhen
> > (DateNum()==EntryDate0 , BarIndex()) ) OR (BarIndex()==ValueWhen
> > (DateNum()==EntryDate1 , BarIndex())));
> >
> >
> >
> > //exit=Name()==STOCKNAME AND BarIndex()==ValueWhen(DateNum()
> > ==ExitDate , BarIndex());
> >
> > break;
> >
> >
> >
> > }
> >
> > }
> >
> > switch ( ShortOrLong )
> > {
> >
> > case "Long":
> > Buy = entry;
> > Sell = Closure;
> > Short = False;
> > Cover = False;
> >
> >
> >
> > break;
> >
> >
> >
> >
> > }
> >
>
------------------------------------
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/
|