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

Re: [amibroker] Yahoo US Database



PureBytes Links

Trading Reference Links

Terry,

the initialisation how I do it is overkill:

// initialise arrays
SellPrice = BuyPrice; SellPrice = 0; 
Sell = SellPrice; exitLevel = Sell;
BuyAdjusted = Sell;

one could also use:

// initialise arrays
SellPrice = 0;
Sell = 0;
exitLevel = 0;
BuyAdjusted = 0;

The way I do it slipped in when I did not yet understand that all arrays have the same length in AFL. I understand that now but usually still implement my procedures this way. It will not hurt the result though,

rgds, Ed

  ----- Original Message ----- 
  From: Terry 
  To: amibroker@xxxxxxxxxxxxxxx 
  Sent: Sunday, September 05, 2004 6:15 AM
  Subject: Re: [amibroker] Help with entry price? (for Ed)


  Chuck,

  Seems like you just need to keep track of whether you have an open Buy
  signal and, if so, do not update the exit level in the sell_proc. This must
  be done inside a loop. I have some code if youčd like to see it. Since
  youčre in town, you could just come over.

  Observation on quick review, the //initialise arrays sets everything to 0
  except the BuyPrice. Seems like a hard way to 0 the arrays as if something
  else was intended.

  Terry
  --

  > Ed,
  > 
  > Thanks so much for taking the time to work on this for me.  I've been
  > working with it for several hours and I still have one problem that I can't
  > solve.
  > 
  > Refreshing your memory as to what this system does:
  > 
  > a.  It buys at the open tomorrow if the close today is below some bollinger
  > band level.
  > b.  It sells at the first profitable close.
  > 
  > The problem arises when there is a fresh "buy" signal prior to getting a
  > sell.  It nicely ignores the buy signal, since it is already long, but it
  > establishes a new entry price based on the "buy" signal that is ignoring.
  > 
  > I'm stumped.
  > 
  > Any ideas?
  > 
  > Thanks
  >   -----Original Message-----
  >   From: ed nl [mailto:ed2000nl@xxxxxxx]
  >   Sent: Friday, September 03, 2004 3:43 PM
  >   To: amibroker@xxxxxxxxxxxxxxx
  >   Subject: Re: [amibroker] Help with entry price?
  > 
  > 
  >   here is the version that uses loopings instead of ApplyStop,
  > 
  >   rgds, Ed
  > 
  > 
  >   procedure sell_proc(Buy,BuyPrice,open,high,low,close) {
  > 
  >   global Sell;
  >   global SellPrice;
  >   global BuyAdjusted;
  >   global exitLevel;
  > 
  >   // initialise arrays
  >   SellPrice = BuyPrice; SellPrice = 0;
  >   Sell = SellPrice; exitLevel = Sell;
  >   BuyAdjusted = Sell;
  > 
  >   exitLevel[ 0 ] = buyPrice[ 0 ];
  > 
  >   for (i = 1; i < BarCount; i++) {
  > 
  >   exitLevel[ i ] = exitLevel[ i - 1 ];
  > 
  >   //
  >   if (Buy[ i ] == 1) {
  > 
  >     BuyAdjusted[ i ] = 1;
  >     exitLevel[ i ] = BuyPrice[ i ];
  > 
  >     // find a sell position + sellprice
  >     for (j = i; j < BarCount; j++) {
  > 
  >      exitLevel[ j ] = exitLevel[ i ];
  > 
  >      // test if profit stop is hit
  >      if (Close[ j ] > exitLevel[ i ]) {
  > 
  >       Sell[ j ] = 1;
  >       SellPrice[ j ] = Close[ j ];
  > 
  >       // enter i-loop past the last sell
  >       i = j;
  > 
  >       // escape from j-loop
  >       j = BarCount;
  > 
  >      }
  > 
  >     }
  > 
  >   }
  > 
  >   }
  > 
  > 
  >   } // end procedure
  > 
  > 
  >   SetBarsRequired(10000,10000);
  > 
  >   Buy = C < BBandBot(C, 10, 2);
  >   BuyPrice = Open;
  > 
  >   sell_proc(Ref(Buy,-1),BuyPrice,open,high,low,close);
  >   Buy = BuyAdjusted;
  >   SellPrice = Close;
  > 
  >   Plot(C,"C",1,64);
  >   Plot(exitLevel,"",colorWhite,1);
  >   Plot(BBandBot(C, 10, 2),"",colorLightBlue,1);
  >   PlotShapes(IIf(Buy,shapeUpArrow,0),colorWhite, layer = 0, yposition =
  > BuyPrice, offset = 0 );
  >   PlotShapes(IIF(Sell,shapeDownArrow,0),colorYellow, layer = 0, yposition =
  > SellPrice, offset = 0 );
  > 
  > 
  > 
  >     ----- Original Message -----
  >     From: ed nl
  >     To: amibroker@xxxxxxxxxxxxxxx
  >     Sent: Friday, September 03, 2004 8:31 PM
  >     Subject: Re: [amibroker] Help with entry price?
  > 
  > 
  >     ofcourse ..... thanks TJ,
  > 
  >     this is how it's done ....
  > 
  >     ; ----------------------------------
  >     SetTradeDelays(1,0,1,0);
  >     SetBarsRequired(10000,10000);
  > 
  >     Buy = C < BBandBot(C, 10, 2);
  >     BuyPrice = Open;
  > 
  >     Sell = 0;
  >     ApplyStop(stopTypeProfit,stopModePoint,0.001,ExitAtStop = 0,False,1 );
  > 
  >     Equity(1);
  >     SellPrice = Close;
  > 
  > 
  >     Plot(C,"C",1,64);
  >     Plot(BBandBot(C, 10, 2),"",colorLightBlue,1);
  >     PlotShapes(IIf(Ref(Buy,-1),shapeUpArrow,0),colorWhite, layer = 0,
  > yposition = BuyPrice, offset = 0 );
  >     PlotShapes(IIF(Sell,shapeDownArrow,0),colorYellow, layer = 0, yposition
  > = SellPrice, offset = 0 );
  >     Title=Name()+ ", O: "+WriteVal(O)+ ", H: "+WriteVal(H)+ ", L:
  > "+WriteVal(L)+ ", C: "+WriteVal(C);
  >     ; ------------------------------------
  > 
  > 
  >       ----- Original Message -----
  >       From: Tomasz Janeczko
  >       To: amibroker@xxxxxxxxxxxxxxx
  >       Sent: Friday, September 03, 2004 8:14 PM
  >       Subject: Re: [amibroker] Help with entry price?
  > 
  > 
  >       Hello,
  > 
  >>       > I want to exit the position whenever the close is above my entry
  >>       > price, including the close on the day of entry.
  > 
  >       This can be successfully achieved using ApplyStop (profit target stop)
  >       with mode set to point and profit set to small value (0.001)
  > 
  >       Best regards,
  >       Tomasz Janeczko
  >       amibroker.com
  > 
  > 
  >       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
  > 
  >         a.. To visit your group on the web, go to:
  >         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.
  > 
  > 
  > 
  >     [Non-text portions of this message have been removed]
  > 
  > 
  > 
  >     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
  > 
  > 
  > 
  > 
  >   --------------------------------------------------------------------------
  > ----
  >     Yahoo! Groups Links
  > 
  >       a.. To visit your group on the web, go to:
  >       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.
  > 
  > 
  > 
  >   [Non-text portions of this message have been removed]
  > 
  > 
  > 
  >   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
  > 
  >     a.. To visit your group on the web, go to:
  >     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.
  > 
  > 
  > 
  > [Non-text portions of this message have been removed]
  > 
  > 
  > 
  > 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
  >  
  > <http://us.ard.yahoo.com/SIG=12973a2ci/M=298184.5285298.6392945.3001176/D=grou
  > ps/S=1705632198:HM/EXP=1094441950/A=2319498/R=0/SIG=11thfntfp/*http://www.netf
  > lix.com/Default?mqso=60185352&partid=5285298>
  > 
  > 
  > 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
  > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe>
  > *  
  > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
  > <http://docs.yahoo.com/info/terms/> .
  > 


  -- 
  Terry



  [Non-text portions of this message have been removed]



  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 
         
        Get unlimited calls to

        U.S./Canada
       
       


------------------------------------------------------------------------------
  Yahoo! Groups Links

    a.. To visit your group on the web, go to:
    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. 



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
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:
    http://docs.yahoo.com/info/terms/