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

[amibroker] Re: Circular issue with duplicate buy signals



PureBytes Links

Trading Reference Links

Thanks Esteban
I will try it out. Appreciate you sharing .... Larry


--- In amibroker@xxxxxxxxxxxxxxx, Esteban <EstebanUno@xxx> wrote:
>
> Here it is Larry. Sorry I didn't check in with the group over the 
weekend,
> thus the delay.
> 
> BuyCnd=some code to establish buy to use in loop;
> SellCnd=some code to establish sell to use in loop;
> ShortCnd=some code to establish short to use in loop;
> CoverCnd=some code to establish cover to use in loop;
> 
> lpos=0; spos=0;
> for( i = 26; i < BarCount; i++ )
> {
>   //Long side evaluation
>   if(BuyCnd[i] AND lpos[i-1]==0) //original buy sig
>   {
>     Buy[i]=1;
>     lpos[i]=1;
>   }
>   if(lpos[i-1]) //continue long
>   {
>     lpos[i]=1;
>   }
>   if(SellCnd[i] AND lpos[i] AND Buy[i-1]==0)
>   {
>     Sell[i]=1;
>     lpos[i]=0;
>   }
>  //short side evaluation
>   if(ShortCnd[i] AND spos[i-1]==0) //original short sig
>   {
>     Short[i]=1;
>     spos[i]=1;
>   }
>   if(spos[i-1]) //continue short
>   {
>     spos[i]=1;
>   }
>   if(CoverCnd[i] AND spos[i] AND Short[i-1]==0)
>   {
>     Cover[i]=1;
>     spos[i]=0;
>   }
> }
> 
> 
> One note. The first bar becomes a buy and I don't know why. I set i 
to 26 to
> start on barcount 26 rather than to 1 trying to avoid this. Doesn't 
have an
> effect.
> 
> Hope the code helps you
> 
> 
> 
> On Sat, Nov 15, 2008 at 9:18 AM, onelkm <LKMCD1@xxx> wrote:
> 
> >   Esteban
> > Would you please post your code, I have the same issue and have 
not
> > gotten a loop to work.
> > Thanks
> > Larry
> > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%
40yahoogroups.com>, "Esteban"
> > <EstebanUno@> wrote:
> > >
> > > Thanks. I was able to model what I want using a For loop like 
you
> > > suggested. It was easier than I thought it would be ... I was
> > hesitant
> > > to even try. The nice thing is that you can do all the array
> > processing
> > > you can before the loop, and then use the arrays in the loop. 
This
> > kept
> > > the loop simple and targeted to my specific problem.
> > >
> > > It still runs quite fast, but there's only one loop.
> > >
> > > --- In amibroker@xxxxxxxxxxxxxxx <amibroker%
40yahoogroups.com>, "Steve
> > Davis" <_sdavis@> wrote:
> > > >
> > > > This kind of problem can be solved by writing a for loop and
> > setting
> > > > the buy/sell signals one bar at a time. You will have complete
> > control
> > > > over the signals, but it will run somewhat slower.
> > > >
> > > > -Steve
> > >
> >
> > 
> >
>



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

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

*********************
TO GET TECHNICAL 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/