Thanks for the tip, I got it now :)
 I was mislead by the help file  where it says:
- ProcessTradeSignals( long Bar )
This mid-level method processes all trading signals for given bar. It should be 
called once per every bar in your custom backtesting loop. 
That's why I thought that I could not use processtradesignals and 
entertrade/exittrade method at the same time.


--- In [email protected], Tomasz Janeczko <gro...@...> wrote:
>
> Hello,
> 
> Yes you can and that is exactly what the example does (look at the AFL 
> code).
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> 
> On 2010-02-15 23:06, Pmxgs wrote:
> > Ok.
> >
> >   After loking at that example, I have one question?
> >   Can I use the exittrade method and use bo.ProcessTradeSignals() at the 
> > same time? I thought that in the low level we could not use 
> > processtradesignals().
> >   I thought that I would need to cycle through all entry signals and call 
> > the entertrade() method and then after this I would have to cycle through 
> > all exit signals and call the exittrade method.
> > Basically my question is this: If I call the processtradesignals in the 
> > beginning of the loop, I don't need to go through all the entrysignals? And 
> > after that I can treat the exit signals using the exittrade method?
> >
> > thanks
> >
> >
> >
> >
> > --- In [email protected], Tomasz Janeczko<groups@>  wrote:
> >    
> >> Hello,
> >>
> >> Assign
> >> Sell = 0;
> >> Cover = 0;
> >>
> >> and use ExitTrade() method in CBT. That is simplest and most
> >> straightforward way to implement what you are after.
> >>
> >>
> >> see
> >> http://www.amibroker.com/kb/2006/03/06/re-balancing-open-positions/
> >>
> >> for example how to do that (you would need to use ExitTrade instead of
> >> ScaleTrade)
> >>
> >> Best regards,
> >> Tomasz Janeczko
> >> amibroker.com
> >>
> >> On 2010-02-15 21:57, Pmxgs wrote:
> >>      
> >>> Hello,
> >>>
> >>>    in that case, do I have to use the low level of CBT? Or is there any 
> >>> variable that I can assign to the signalobject so that the backtester 
> >>> skips those exit signals received from the 1st phase?
> >>>    As I described in the previous post, almost my trading system can be 
> >>> coded using "regular" phase. Only the stop loss exit  needs to use custom 
> >>> backtester.
> >>>
> >>>    thanks
> >>>
> >>>
> >>>
> >>> --- In [email protected], Tomasz Janeczko<groups@>   wrote:
> >>>
> >>>        
> >>>> Hello,
> >>>>
> >>>> The suggestion was wrong.
> >>>> PosSize property of signal object is only effective for ENTRY and
> >>>> SCALING (in/out) signals.
> >>>> EXIT signals just EXIT (close entire) position.
> >>>>
> >>>> Best regards,
> >>>> Tomasz Janeczko
> >>>> amibroker.com
> >>>>
> >>>> On 2010-02-15 17:41, Pmxgs wrote:
> >>>>
> >>>>          
> >>>>>     Hi,
> >>>>>
> >>>>>     I followed this suggestion which was to write sell=1 in the first 
> >>>>> phase of the backtest and then assign 0 to the possize property of  the 
> >>>>> signal object to avoid exiting trades (the condition to exit trades is 
> >>>>> only if profit from current open positions is greater than    -8000 but 
> >>>>> less than 5000). (profit>5000 is when profit target is hit)
> >>>>>
> >>>>> If I assign zero to possize in case of a sell, does the backtester skip 
> >>>>> this exit signal?
> >>>>> I don't get any response from the trace statement, so I'm doing several 
> >>>>> things wrong.
> >>>>>
> >>>>>
> >>>>> Here is my code to ilustrate what I'm trying to do. Any help ?
> >>>>>
> >>>>> SetCustomBacktestProc("");
> >>>>> if (Status("action") == actionPortfolio) {
> >>>>>        bo = GetBacktesterObject();      //  Get backtester object
> >>>>>
> >>>>>        bo.PreProcess(); //  Do pre-processing (always required)
> >>>>>        for (i = 0; i<    BarCount; i++) //  Loop through all bars
> >>>>>        profit=0;
> >>>>>         {
> >>>>>         for (trade = bo.GetFirstOpenPos(); trade; trade = 
> >>>>> bo.GetNextOpenPos())
> >>>>>                         {       //  Loop through all open positions
> >>>>>                profit=profit+ trade.GetProfit() ;
> >>>>>               _TRACE("profit at bar "+profit+"-"+i);
> >>>>>                         }                       
> >>>>>
> >>>>>            for (sig = bo.GetFirstSignal(i); sig; sig = 
> >>>>> bo.GetNextSignal(i))
> >>>>>            {    //  Loop through all signals at this bar
> >>>>>
> >>>>>                if (sig.Isexit()&&    profit>-8000&&    profit<5000) 
> >>>>> //skip exits              {
> >>>>>                    _TRACE("exit signal at bar "+i);
> >>>>>                    sig.possize=0;
> >>>>>                  }
> >>>>>            }    //  End of for loop over signals at this bar
> >>>>>            bo.ProcessTradeSignals(i);   //  Process trades at bar 
> >>>>> (always required)
> >>>>>        }        //  End of for loop over bars
> >>>>>        bo.PostProcess();        //  Do post-processing (always required)
> >>>>> };
> >>>>>
> >>>>>
> >>>>>
> >>>>>     thanks
> >>>>>
> >>>>> --- In [email protected], "Pmxgs"<pmxgs@>    wrote:
> >>>>>
> >>>>>
> >>>>>            
> >>>>>>     Good idea. I hadn't hink of it that way.
> >>>>>>     Let's see if I can code it correctly.
> >>>>>>
> >>>>>>     thanks
> >>>>>>
> >>>>>> --- In [email protected], "Mike"<sfclimbers@>    wrote:
> >>>>>>
> >>>>>>
> >>>>>>              
> >>>>>>> Medium level CBT allows to cancel buy signals by setting position 
> >>>>>>> size to 0. Assuming the same applies for sell signals (i.e. cancel 
> >>>>>>> the signal), you could try using "Sell = 1;" as your sell logic and 
> >>>>>>> then cancel the signals using medium CBT when not applicable.
> >>>>>>>
> >>>>>>> I'm not necessarily recommending the above. Just pointing out that it 
> >>>>>>> could potentially be done without low level CBT, if so desired.
> >>>>>>>
> >>>>>>> Mike
> >>>>>>>
> >>>>>>> --- In [email protected], "Pmxgs"<pmxgs@>    wrote:
> >>>>>>>
> >>>>>>>
> >>>>>>>                
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>>       I'm trying to create a system where all my entry rules can be 
> >>>>>>>> defined without cbt, but the exit rule (which is to close all 
> >>>>>>>> positions if the loss of all open positions is greater than 5% of 
> >>>>>>>> equity).
> >>>>>>>>
> >>>>>>>>     Since I have to use exit trade method of cbt, do I need do use 
> >>>>>>>> the lowest level described in the help section of cbt?
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>     thanks
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>                  
> >>>>>>>
> >>>>>>>                
> >>>>>>
> >>>>>>              
> >>>>>
> >>>>> ------------------------------------
> >>>>>
> >>>>> **** 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
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>            
> >>>>
> >>>>          
> >>>
> >>>
> >>> ------------------------------------
> >>>
> >>> **** 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
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>        
> >>      
> >
> >
> >
> > ------------------------------------
> >
> > **** 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
> >
> >
> >
> >
> >
>


Reply via email to