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. testing actually done to the tick level, assuming tick data 
exists, even though you are observing a Daily chart). This can be 
somewhat helpful for visualizing and testing some kinds of strategies, 
but tests done this way run at tick-bar speed, not at Daily bar speed. 
In any case, AB does not work this way.

I recommend testing your system on a low enough timeframe such that 
entries and exits never occur on the same bar.

I also recommend, if you need Daily TA numbers, then run on, say, a 5m 
chart (or even a 30m chart, depending), and write your code to use AB's 
time-compression/expansion to do the Daily-level TA.

- Progster


On 6/16/2010 3:50 PM, Gonzaga wrote:
>
> 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 use settradedelays (1,1,1,1);
> the stops execute in the same bar as stop-loss signal, using the 
> parameter in settings "exit intraday at stop(1)",which, as help files 
> says, "check High-Low prices and exit intraday on price equal to stop 
> level on the same bar when stop was triggered".
> I also set "activate stops immediately", which is supposed that if 
> it's activated, "stop is activated after current bar signals"
> And I also set to true, (I dont know if it's needed) "allow same bar exit"
>
> Well, my system buys the day after buy signal, at open. And the stop 
> should sell in the stoploss limit exactly, at least if the stop 
> triggers in the same buying bar. If it is in another bar, there could 
> be a gap that make bigger the loss, of course.
>
> Well, there's no way. I obtain any loss, in the same bar, in different 
> bars, and never limit to the stop loss number.
> I understand nothing.
> Does anybody know how to enter at next-bar open, and let the stoploss 
> triggers in the same bar of the stop signal?
> Or at least, where is a clear paper explaining the exact usage of the 
> amibroker's stops??
>
> Thanks a looot
>
>
> --- In [email protected] <mailto:amibroker%40yahoogroups.com>, 
> "Gonzaga" <gonzag...@...> wrote:
> >
> > 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", 1000000 );
> > SetOption("AllowPositionShrinking", True );
> > SetOption("MaxOpenPositions", PosQty );
> > SetOption ("accountmargin",100);
> > PositionSize = -100/(posqty);
> > //-----------
> >
> > SetTradeDelays(1,1,1,1);//buy after signal
> > ApplyStop(stopTypeProfit, stopModePercent,2, 1);//exit intraday on 
> same bar at 2%
> >
> > /CONDITIONS---------------------------------------
> > Cond1=Cross(MACD(12,26),0);
> > //long entry-----------------------------
> > PositionScore= 100-StochK(15,3);
> > Buy= Cond1;
> > BuyPrice=Open*1.001;//in open next bar!
> > Sell=Cross(Signal(12,26,9),MACD(12,26));//sell in open next bar
> > SellPrice=Open*0.999;
> > Buy=ExRem(Buy,Sell); Sell=ExRem(Sell,Buy);
> >
> > //------------END OF CODE------------------
> >
> > It is really simple. Well, the problem is that the profit loss, many 
> times (nearly always) triggers, at 2.3%, 2.4%, 2.5%. Very strange, it 
> should be at 2% or very close.
> >
> > I thought that this logic means that should never have a profit-sell 
> more than 2%, if it is sold in the same bar as bought, isn't it?
> > Well, the backtest sells many times in the same bar as buy, with a 
> much more profit than 2%... ?¿¿¿
> > And also, I have sometimes big profits in later bars, although that 
> could be if sold at the open..
> >
> > It's incredible, I can not even guess the mistake..
> > I don't know what to do, at the moment.
> > I'll post if I discover my error, it must be a silly thing..
> >
> > greetings
> >
>
> 


------------------------------------

**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to 
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

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:
    [email protected] 
    [email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to