Hi, thanks for the help.
But I think it does not work.
The sell conditions not always sells correctly.
I think that if you try to check barssince(system1)>barssince(system2), it 
sometimes have a wrong signal, because system1 or system2 are arrays that keeps 
its values

Anyway, the system1 are many times badly close..

mm.. I am trying to solve..


--- In amibroker@yahoogroups.com, "Ronen" <ronen.ma...@...> wrote:
>
> System1 = ....;
> System2 = ....;
> 
> 
> Buy = System1 Or System2;
> 
> Sell = iif(barssince(System1) > barssince(System2), // Enter System1 sell 
> criteria, // Enter System2 sell criteria);
> 
> /*
> Let's say you get 10 signals to buy System1 and 10 for System2 on a 
> particular day.  Therefore you have 20 total signals.
> Assuming the max positions you can take in your portfolio is 10.  You have to 
> decide which signals to take.  This can be done
> with positionscore.  But, positionscore will have to represent both systems.  
> So, on the day that has 20 signals, the signals
> with the highest positionscore will be entered on, regardless of which system 
> it is.  So, both systems will be competing for 
> the money.  For instance, positionscore could be historical volatility.  
> Highest historical volatility signal will be entered,
> with a max of 10 positions.
> 
> I hope I'm not being reduntant, and this helps you and it's what you're 
> looking for.
> */
> 
> --- In amibroker@yahoogroups.com, "Gonzaga" <gonzagags@> wrote:
> >
> > I got it!
> > Well, I'm not sure I get it. 
> > I've thought a way to avoid the custom  backtester.
> > I create an array that is filled with two numbers, 1 or 2. 1 means the 
> > trade signal has been launched by system 1, and 2, the system 2.
> > 
> > After that, I read the array from n bars behind, using -barssince(buy)
> > 
> > Could this have sense?
> > 
> > This is the code instead of the custom backtest:
> > 
> > //BEGINING OF CODE--------------
> > 
> > Buy=IIf(Buy1,True,IIf(Buy2,True,False));
> > 
> > BuyPrice=Open;
> > 
> > typeBuy=IIf(Buy1,1,IIf(Buy2,2,0));//if buy1, array 'typebuy' is 1. If Buy2, 
> > is 2. Else is 0
> > 
> > //sell using condition A if was bought using condition1. Sell using 
> > condition2 if buy2
> > 
> > Sell=IIf(Ref(typebuy,-BarsSince(Buy))==1,   Cross(MA(C,50),MA(C,15)), 
> >       IIf(Ref(typebuy,-BarsSince(Buy))==2,    Ref(Buy,-2) ,     False    ));
> > 
> > 
> > //END OF CODE
> > 
> > greetings
> > 
> > 
> > --- In amibroker@yahoogroups.com, "Gonzaga" <gonzagags@> wrote:
> > >
> > > Ah, Ok 
> > > don't worry - - No te preocupes.. ;-)
> > > 
> > > 
> > > --- In amibroker@yahoogroups.com, "Matthias K." <meridian202@> wrote:
> > > >
> > > > Que tal gonzaga?
> > > > 
> > > >  
> > > > 
> > > > After sending this email, I figured that this might happen: I was 
> > > > answering
> > > > to Paul's post. Strange Yahoo, sorry for the confusion. I'm afraid I 
> > > > cannot
> > > > help you on your custom backtest proc, yet.
> > > > 
> > > >
> > >
> >
>


Reply via email to