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

Re: [amibroker] Changing the stop loss depending on the stock price?



PureBytes Links

Trading Reference Links

Hi,

I experimented with those, and found a bug I think.. Here is the code:

//
SetOption("UseCustomBacktestProc", False);
//
SetOption("MaxOpenPositions", 5 );
SetOption("InitialEquity", 100000 );
SetOption("AllowPositionShrinking", True );
SetOption ("AllowSameBarExit", False);
SetOption ("ActivateStopsImmediately", False);
SetOption ("MinShares", 100);
SetOption ("MinPosValue", 5000);
SetOption ("PriceBoundChecking", True);
SetOption ("CommissionMode", 2);
SetOption ("CommissionAmount", 25);
SetOption ("AccountMargin", 100);
SetOption ("ReverseSignalForcesExit", True);
SetOption ("UsePrevBarEquityForPosSizing", True);
SetOption ("PortfolioReportMode", 0);

Strangely enough, when I use the "backtesting", suddenly there is a one-shot -10,000,000$ drawdown that suddenly appears on the screen (one day there is no drawdown or so, and the next day -10,000,000$!!), and I don't see any losing position that much...  And when I erase those "setoptions" everything get back to normal. You ever experienced that?

Anyway, I will try to experiment more and then I'll try to see if I understand things right.  (I just hope that bug isn't permanent...)

Louis


2008/2/22, Thomas Ludwig <Thomas.Ludwig@xxxxxx>:
Louis,

the setoption syntax can be found in the manual or here:
http://www.amibroker.com/guide/afl/afl_view.php?id=201 with references
to examples in the AB library.

Regards,


Thomas


> Hi,
>
> Unfortunately, I am not sure how to use this thing:
>
> // Set all options here:
> > setoptions( 1 .........);
> > setoptions(2. ........) ;
> > setoptions(3. ........) ; //etcetera
> > BuyPrice = SellPrice = Open;// or whatever you want
> > SetTradeDelays( 1,1,0,00; // etc.
> >
> > // Define Buy and Sell conditions
> >
> > Buy1 = myBuyCondition:
> > Sell = 0; // if you have only use Applystops to exit.
> >
> > amount = IIF(Close < 10, ... , ... ); // etcetera
> > Applystop(stoptypeL oss,..... ....); // etcetera.
> >
> > Equity(); // this helps to plot arrows on the charts so you can
> > confirm
> > if AB is doing what you told it to do.
> > // if not you have goofed up code somewhere and
> >
> > //then plot your stuff
>
> I don't know what to do with the ".....".. I mean: what do I put
> there? Would it be possible to get an example of what can be done so
> I can have something to work from?  I looked at the help files but
> found no examples about this kind of thing.  I know how to use
> individually some "setoption" features, but I just don't get it...
> yet.  I am still a beginner... I will catch up pretty quick, but I am
> not sure about this yet.
>
> Thanks!
>
> Louis
>
> 2008/2/22, Thomas Ludwig <Thomas.Ludwig@xxxxxx>:
> > Louis,
> >
> > > Hi,
> > >
> > > Ok I think I understand... If I want to use custom values, I need
> > > to build the code for the backtesting, and then I will have to
> > > click the "Enable custom backtest procedure" button.  I can't
> > > just use what's there and add some things to it.
> >
> > No, you don't need custom backtester at this stage, IMHO.
> >
> > > So, basically, if I want to:
> > >
> > > 1) Change the % loss-stop depending on the price;
> >
> > Just use the code provided by Chris.
> >
> > > 2) Sell half my position after a % of profit or after some other
> > > conditions;
> >
> > An example that gives you an idea how to do it can be found in the
> > manual: Tutorial -> Amibroker Formula Language ->
> > Pyramiding/scaling and multiple currencies -> Example 4
> >
> > Regards,
> >
> > Thomas
> >
> > > I have to build the whole backtesting procedure.  Is this right?
> > >
> > > I really like the help files, but there should be more examples
> > > with them. I learn a lot by watching examples!
> > >
> > > Thanks!
> > >
> > > Louis
> > >
> > > 2008/2/22, Thomas Ludwig <Thomas.Ludwig@xxxxxx>:
> > > >   > The Help file will explain.
> > > > >
> > > > > Help > SetOptions
> > > > > Help > BuyPrice
> > > > > Help> Applystop
> > > > >
> > > > > The Help files are full of good examples of code.
> > > >
> > > > Indeed. And a nice framework for AB beginners can be found
> > > > here: http://www.amibroker.com/library/detail.php?id=547
> > > >
> > > > Regards,
> > > >
> > > > Thomas
> >
> > 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




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/


__._,_.___

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




Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___