[amibroker] Re: doubt with stops

2010-06-18 Thread Mike
That is very likely due to commission. In the General tab of the AA settings, set Commission rates to $per trade and enter 0 in the area beside that option. Also, set Interest rate to 0 and set margin to 100. This should give you the results you expect. You can then decide later if you want to

[amibroker] Re: doubt with stops

2010-06-17 Thread progster01
Your code seems to work for me here. Here it is again, just slightly tweaked: //SETTINGS--- PosQty=Param(Posiciones,10,1,20,1); SetOption(InitialEquity, 100 ); SetOption(AllowPositionShrinking, True ); SetOption(MaxOpenPositions, PosQty ); SetOption (accountmargin,100); PositionSize =

[amibroker] Re: doubt with stops

2010-06-17 Thread Gonzaga
Thanks for testing the code. I have tested your tweaked code also, using a portfolio of stocks, or even just one stock. For example, in EOD bars, this code buys GRA on 6th feb2009, selling in the same bar in a profit stop on 6th Feb. Ok. But, it sells with 4.65% change (4.5% profit), nearly in

[amibroker] Re: doubt with stops

2010-06-17 Thread Gonzaga
G! I am crazy with stops. I can not find any sense on them.. Just this code: //-- SetTradeDelays(1,1,1,1); ExitPct =10; ApplyStop(stopTypeLoss, stopModePercent, ExitPct, 1); // //CONDITIONS--- Cond1=Cross(MA(C,10),MA(C,50));

[amibroker] Re: doubt with stops

2010-06-17 Thread Mike
Hi, I haven't done much with ApplyStop. But, the scenario that you are trying to accomplish is provided as an example in the user guide here: http://www.amibroker.com/guide/afl/afl_view.php?id=20 http://www.amibroker.com/guide/afl/afl_view.php?id=20

[amibroker] Re: doubt with stops

2010-06-17 Thread Gonzaga
Thanks a lot, Mike, you're very kind! [:)] I have tried the code as you've posted. I buy in the same dates as you, but, the stops sells sligthly more cheap, I don't know why!I thought could be my commissions table, but I have get it out, and the problem still there..This is my backtest: As you

[amibroker] Re: doubt with stops

2010-06-17 Thread Gonzaga
UPS!. The image does not appear! Well this is, written, my backtest: Ticker-- Trade-- date--- price-- Exdate---exprice--%chg-- %profit AA--MaxLoss 10-Nov-05 --26.25--18-sep-08- 23.5 -10.48% -10.51% AA--MAxloss21-jul-05 28.7

Re: [amibroker] Re: doubt with stops

2010-06-16 Thread Howard B
Hi Gonzaga -- Check the users guide for ApplyStop. Your afl can have more than one exit, and it is common for a trading system to include both exits described by logic (Sell = xxx;) and by ApplyStop -- perhaps more than one of each. If you have several ApplyStop statements (profit target,

[amibroker] Re: doubt with stops

2010-06-16 Thread Gonzaga
Thanks a lot, Howard. I've been reading the help, but I cannot find my mistake. Is very strange, because the code is quite simple. It is similar to this: // //SETTINGS--- PosQty=Param(Posiciones,10,1,20,1); SetOption(InitialEquity, 100 );

[amibroker] Re: doubt with stops

2010-06-16 Thread Gonzaga
Well, I have to admit that I don't understand at all the stop system performed by Amibroker. I have super-simplified my code, letting only a buy condition, and a stop, established in the settings dialog, to avoid any code mistake. So, I want to have a stoploss or stop profit, for example 5%. I

Re: [amibroker] Re: doubt with stops

2010-06-16 Thread Progster
Gonzaga, If a chart bar is the smallest data unit under test, your test cannot be accurate if price-based entries and exits take place in the same bar. This is because the path of price inside the bar is not known. Some platforms have an inside the bar smallest data unit under test (e.g.

[amibroker] Re: doubt with stops

2010-06-16 Thread Gonzaga
Thanks for the answer. But I don't understand, yet. I'm sorry, but, suppose the next purchase: Using end-of-day bars: The system triggers a buy signal. Then I buy on next day bar, just in the open. Then, the stoploss should 'look the price', selling in the same bar if loss is reached. How could

[amibroker] Re: doubt with stops

2010-06-15 Thread Gonzaga
I've just realized that my problem my be related with the sell signal. For I use a profit stop, but also a sell condition; and both are different. So, how does combine sell conditions with stops? Could I have problems if I mix both? --- In amibroker@yahoogroups.com, Gonzaga gonzag...@...