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

Re: [amibroker] Re: lastvalue challenges



PureBytes Links

Trading Reference Links

Hello,
 
Not sure what you are after....but here is some code I have ....
 

//trading rules

Buy = Cross( MACD(), Signal());

Sell=Cross(Signal(),MACD());

BarsSinceentry =0;

poslong=0;posshort=0;

for( i = 0; i < BarCount; i++ )

{

if( Buy[i])

{

poslong=1;posshort=0;

}

if(Sell[i])

{

poslong=0;posshort=1;

}

if(poslong==1)

{

if(Buy[i])

BarsSinceentry[i]=0;//BarsSinceentry[i-1]+1;

else

{

if(poslong==1)

BarsSinceentry[i]=BarsSinceentry[i-1]+1;

}

}

}

Days=BarsSinceentry;

Plot(C,"",colorBlack,styleCandle);

PlotShapes(Buy*shapeUpArrow,colorGreen);

Title=Name()+ " BarsSinceBuy [ "+WriteVal(Days,1)+ "]";

----- Original Message -----
Sent: Sunday, February 22, 2009 12:20 PM
Subject: [amibroker] Re: lastvalue challenges


thanks for your input. however you are indicating to hardcode the
barsSince(Buy) < <somefixedvalue>
how do i get it based on scan filter in the AA window. i could use
last bars or date range or something else that AA allows.

--- In amibroker@xxxxxxxxxps.com, "Thomas Z." <tzg@xxx> wrote:
>
> Hello,
>
> you can do this with the barsSince() function. For example:
>
> Condition = barsSince(Buy) < 50;
>
> Thomas
> www.PatternExplorer.com
>
>
>
>
> -----Original Message-----
> From: amibroker@xxxxxxxxxps.com [mailto:amibroker@xxxxxxxxxps.com]
On Behalf
> Of murthysuresh
> Sent: Sunday, February 22, 2009 5:15 PM
> To: amibroker@xxxxxxxxxps.com
> Subject: [amibroker] lastvalue challenges
>
> hello
> i use the lastvalue(buy) to check if it got triggered before adding
the
> ticker to the watchlist. this works only if i have Range=last n
> quotations =1 on my filters.
> if i use a date range, it does not work properly.
> any ideas on how to overcome this.
>
>
>
> ------------------------------------
>
> **** 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/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___