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 ----- 
  From: murthysuresh 
  To: [email protected] 
  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 [email protected], "Thomas Z." <t...@...> wrote:
  >
  > Hello,
  > 
  > you can do this with the barsSince() function. For example:
  > 
  > Condition = barsSince(Buy) < 50;
  > 
  > Thomas
  > www.PatternExplorer.com
  > 
  > 
  > 
  > 
  > -----Original Message-----
  > From: [email protected] [mailto:[email protected]] 
  On Behalf
  > Of murthysuresh
  > Sent: Sunday, February 22, 2009 5:15 PM
  > To: [email protected]
  > 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
  >


  

Reply via email to