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

RE: [amibroker] Foreign and Data Holes



PureBytes Links

Trading Reference Links




Gary,
 
No, I am not trying to pyramid an existing position.  I 
only want to buy the first time RSI drops below 30, then hold it until the trade 
is profitable, so the code below does not do what I 
want.
 
I was hoping to do this with the code I was using below, but 
I'll just use a profit target instead.  Thanks for your help.
 
Linda
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Gary 
  A. Serkhoshian 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: June 22, 2004 9:35 PM
  Subject: Re: [amibroker] Problem with 
  Extraneous Buy Signals
  Linda,Two questions:1.  Are you doing 
  this in order to pyramid an existingposition?2.  Why not use 
  profit stop?Here is my code adjustements that will cause a sell(if 
  in existing position)  and new buy when RSI(14)crosses below 
  30.Have fun,GaryVar0 = 1;SetOption 
  ("InitialEquity", 100000);SetOption ("MaxOpenPositions", 
  Var0);PositionSize = -100/Var0; // to compound resultsBuyPrice 
  = Open;SellPrice = Close;SetTradeDelays ( 1, 0, 1, 1); // buy, 
  sell, short,cover// BUYCond1 = Cross(30, RSI(14)); 
  //RSI(14)<30;Buy = Cond1 ;// SELLCond102 = Close 
  > Ref(BuyPrice,-BarsSince(Buy)+1);Sell = Cond102 OR Cond1 
  ;Buy = ExRem (Buy, Sell);Sell = ExRem (Sell, 
  Buy);Filter =1 ;AddColumn(RSI(14), "RSI 14", 5.2, 
  colorDefault,(Cross(30, RSI(14)) * colorBrightGreen) + ((NOT Cross(30, 
  RSI(14))) * colorDefault));AddColumn(Cond102, "Sell Condition 102", 
  5.0,colorDefault, Cond102 * colorYellow + (NOT Cond102) 
  *colorDefault);AddColumn(Buy, "Buy", 5.0, colorDefault, (Buy 
  *colorBrightGreen) + ((NOT Buy) * colorDefault));AddColumn(Sell, 
  "Sell", 5.0, colorDefault, (Sell *colorYellow) + ((NOT Sell) * 
  colorDefault));--- Linda Wilmarth <smart@xxxxxxxxxx> 
  wrote:> Gary,> > This changes the results, but doesn't 
  solve the> problem completely.> > On 2/27/02, the RSI 
  crosses below 30 and so the> system buys on 2/28/02 like it 
  should.  The RSI then> rises above 30, but the Close is not high 
  enough> over the next couple days to make the Sell condition> be 
  True.  Then on 3/2/01, the RSI falls below 30> again.  Since 
  the system is already in the middle of> a trade, there is not another 
  buy signal, which is> what I want.  > > But the code 
  now exits when the close is higher than> what the entry would have been 
  on the 2nd> (potential) signal instead of what the entry really> 
  was on the first (real) signal.  The system exits at> a loss, when 
  I want to always wait until there is a> profit before exiting.> 
  > Linda  >   ----- Original Message ----- 
  >   From: Gary A. Serkhoshian >   To: 
  amibroker@xxxxxxxxxxxxxxx >   Sent: June 22, 2004 8:37 
  PM>   Subject: Re: [amibroker] Problem with 
  Extraneous> Buy Signals> > >   
  Linda,> >   The problem is that > 
  >   Cond1 = RSI(14)<30> >   is 
  always true when RSI is below 30.  All you want> 
  is>   the cross.  So, use Cross(30, RSI(14)) 
  instead.> >   Regards,>   
  Gary> >   --- Linda Wilmarth <smart@xxxxxxxxxx> 
  wrote:>   > I am having problems with a system that I 
  am>   > writing.  >   > 
  >   > I have simplified it to the basics for 
  testing>   > purposes.  At this point, I am testing 
  the> system>   > using EOD data for QQQ only.  
  >   > >   > The system will buy at the 
  next Open if the> 14-day>   > RSI is less than 
  30.  Then I want to sell at the>   > first close 
  where I have made a profit, which> may>   > even be 
  the same day that I buy.>   > >   > 
  The code works fine if the RSI drops below 30> for 
  1>   > day only, e.g. it buys and sells on 4/17/00, 
  and> it>   > buys on 4/29/02 and sells on 
  4/30/02.  >   > >   > But if the 
  RSI stays below 30 for more than 1> day,>   > the 
  code does not work.  For example, the RSI> 
  drops>   > below 30 on 10/10/00 and the system 
  correctly> buys>   > on 10/11/00.  It should 
  sell on the same day>   > (10/11/00) because there would 
  have been a small>   > profit that day.  But it does 
  not - the RSI is> also>   > less than 30 on 
  10/11/00 and the code does not>   > produce the desired 
  results.  It waits until>   > 10/12/00 to sell.  
  Then it buys again on> 10/12/00,>   > which it 
  should since the RSI on 10/11 was less> than>   > 
  30, but does not sell until 2/28/01, when it> 
  should>   > have sold the next day on 
  10/13/00.>   > >   > I've included the 
  code below.  Anyone have an> idea>   > what I 
  am doing wrong?>   > >   > 
  Thanks>   > >   > 
  Linda>   > >   > Var0 = 
  1;>   > >   > SetOption 
  ("InitialEquity", 100000); >   > >   > 
  SetOption ("MaxOpenPositions", Var0);>   > 
  >   > PositionSize = -100/Var0; // to compound 
  results>   > >   > BuyPrice = 
  Open;>   > >   > SellPrice = 
  Close;>   > >   > SetTradeDelays ( 1, 
  0, 1, 1); // buy, sell,> short,>   > 
  cover>   > >   > // 
  BUY>   >>  
  >-------------------------------------------------------------->   
  > >   > >   > Cond1 = 
  RSI(14)<30;>   > >   > Buy = Cond1 
  ;>   > >   > // 
  SELL>   >>  
  >-------------------------------------------------------------->   
  > >   > >   > Cond102 = Close 
  >> Ref(BuyPrice,-BarsSince(Buy)+1);>   > 
  >   > Sell = Cond102 ; >   > 
  >   > Buy = ExRem (Buy, Sell);>   > 
  >   > Sell = ExRem (Sell, Buy);>   > 
  >   > > > > 
  >               
  >   __________________________________>   Do 
  you Yahoo!?>   New and Improved Yahoo! Mail - Send 10MB 
  messages!>   <A 
  href="">http://promotions.yahoo.com/new_mail 
  > > >   Check AmiBroker web page 
  at:>   <A 
  href="">http://www.amibroker.com/> 
  >   Check group FAQ at:><A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html> 
  > > >         
  Yahoo! Groups Sponsor 
  >               
  ADVERTISEMENT>              
  >        
  >        > > 
  >------------------------------------------------------------------------------>   
  Yahoo! Groups Links> >     a.. To visit your 
  group on the web, go to:>     <A 
  href="">http://groups.yahoo.com/group/amibroker/>       
  >     b.. To unsubscribe from this group, send 
  an> email to:>     
  amibroker-unsubscribe@xxxxxxxxxxxxxxx>       
  >     c.. Your use of Yahoo! Groups is subject to 
  the> Yahoo! Terms of Service.. > > > 
        
              
  __________________________________Do you Yahoo!?New and Improved 
  Yahoo! Mail - 100MB free storage!<A 
  href="">http://promotions.yahoo.com/new_mail 
  Check AmiBroker web page at:<A 
  href="">http://www.amibroker.com/Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html








Yahoo! Groups Sponsor


  ADVERTISEMENT 












Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.