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

[amibroker] Re: help with trading system



PureBytes Links

Trading Reference Links

hi,

thanks for your reply.

I tried with settradedelays(0,0,0,0) which is the default. Doesn't 
this mean that the buydelay and the selldelay are 0, or 0 days/bars?

So, that would mean that it would look for a sell at the same day of 
purchase?

>From the help and the manual I can't figure out wether the buydelay, 
selldelay etc inside settradedelays are flags or actual days (bars). 

However in my little program below setting settradedelays(0,0,0,0) 
does not sell at the same day of purchase when it should.

thanks and regards, Ed


--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> Ed
> check settings/trade delay  it sounds like you have it set to 1 
which means
> "Next bar"
> 
> Regards,
> Jayson
> -----Original Message-----
> From: ed2000nl [mailto:pablito@x...]
> Sent: Monday, September 29, 2003 10:23 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Re: help with trading system
> 
> 
> hi,
> 
> I have one additional question (for now ...). I have this simple
> trading system (see below). I buy at the open. If I would like to
> sell the same day at the close if it exceeds the threshold of in 
this
> case 4% how do I program that. Now it only starts finding sell
> signals the day after the purchase.
> 
> thanks, Ed
> 
> 
> 
> // -----------------------------------------------------------------
-
> // make a simple trading system
> Buy = Cross(RSI(),30);
> 
> // buy the next day at the open
> // use Ref(Buy -1) because the Ref function returns a value
> // so the "1" numbers inside the Buy array are moved forward this 
way.
> Buy = Ref(Buy, -1);
> 
> // define the BuyPrice
> BuyPrice = ValueWhen( Buy, Open);
> 
> SellCond1 = C > BuyPrice * 1.04;
> SellCond2 = C < BuyPrice * 0.96;
> SellCond3 = Cross( BarsSince(Buy), 5 );
> 
> Sell = SellCond1 OR SellCond2 OR SellCond3;
> 
> SellPrice = (SellCond1 * C);
> SellPrice = SellPrice + (SellCond2 * C);
> SellPrice = SellPrice + (SellCond3 * C);
> 
> Buy = ExRem(Buy,Sell);
> Sell = ExRem(Sell,Buy);
> // -----------------------------------------------------------------
-
> 
> 
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Graham" <gkavanagh@xxxx> wrote:
> > Ed, you should not need to do loops for this, just set the
> conditions you
> > want.
> > Is this close to what you were wanting?
> >
> > SetTradeDelays( 0, 0, 0, 0 );
> > Buy = YourBuyCondition;
> > Buy = Exrem( Buy, Sell );
> > SellCond1 = Cross( C, Valuewhen( Buy, C) * 1.02 );
> > SellCond2 = Cross( Valuewhen( Buy, C) * 0.96, C );
> > SellCond3 = Cross( Barssince(buy), 5 );
> > Sell = SellCond1 OR SellCond2 OR SellCond3 ;
> > SellPrice = C;
> >
> >
> > Cheers,
> > Graham
> > http://groups.msn.com/ASXShareTrading
> > http://groups.msn.com/FMSAustralia
> >
> >
> > -----Original Message-----
> > From: ed2000nl [mailto:pablito@x...]
> > Sent: Monday, 29 September 2003 4:45 PM
> > To: amibroker@xxxxxxxxxxxxxxx
> > Subject: [amibroker] help with trading system
> >
> >
> > hi,
> >
> > I need some basic help with trading systems. I am so used to an
> other
> > programming language and can't seem to find out how to fully
> utilise
> > AB in similar ways.
> >
> > as an example I want to find out how to program a simple system
> >
> > 1) say I got my "buy" array defined.
> >
> > 2) now I want to sell in the following days at the close whenever
> the
> > price has increased by 2% or more.
> >
> > 3) I sell with a loss at the close whenever the price decreases by
> 4%
> > or more.
> >
> > 4) and I sell at the close price when the number of trading days
> > exceeds 5 and the stock is still in possesion.
> >
> > How could I use AFL in the best way. Do I need to use loopings?
> >
> > thanks in advance,
> >
> > Ed
> >
> >
> > ------------------------ Yahoo! Groups Sponsor -------------------
--
> ~--> Buy
> > Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
> Printer
> > at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
> > http://www.c1tracking.com/l.asp?cid=5511
> > http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
> > ------------------------------------------------------------------
--
> -~->
> >
> > Send BUG REPORTS to bugs@xxxx
> > Send SUGGESTIONS to suggest@xxxx
> > -----------------------------------------
> > Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> > (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> > --------------------------------------------
> > Check group FAQ at:
> > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> >
> > Your use of Yahoo! Groups is subject to
> http://docs.yahoo.com/info/terms/
> 
> 
>       Yahoo! Groups Sponsor
>             ADVERTISEMENT
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
> (Web page: http://groups.yahoo.com/group/amiquote/messages/)
> --------------------------------------------
> Check group FAQ at:
> http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/