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

[amibroker] Re: help with trading system



PureBytes Links

Trading Reference Links

OK thanks. I see I have a lot more studying and playing ahead of me. 
I'm not sure if I understand the bit about ValueWhen() completely but 
for now I will not use it if I also use SetTradeDelays(). 

thanks and
regards, Ed


--- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <amibroker@xxxx> 
wrote:
> Hello,
> 
> > thanks. I found the proper buy and sell signals. Still I am 
> > puzzled ... my super simple code does not give proper results. If 
I 
> > execute this code on CTMI I get 3 trades. However, it not always 
buys 
> > at the open like I tell it to. Do you agree when looking at the 
code 
> > below that it *always* should buy at the open?
> 
> No. To buy always at open you should write:
> 
> BuyPrice = Open;
> 
> (isn't this obvious ?)
> 
> If you write
> 
> BuyPrice = ValueWhen(Buy, Open);
> 
> and you SET DELAY > 0
> this code actually attempts to buy at OPEN price WHEN NON DELAYED 
buy
> occurred. Since trading is delayed as per your setting the open of
> N-days before may NOT fit into High-LOW range of the bar when
> ACTUAL TRADE takes place so AmiBroker must readjust it to
> fit into H-L range (what ever is nearer your desired price).
> 
> 
> Hope this helps.
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> ----- Original Message ----- 
> From: "ed2000nl" <pablito@xxxx>
> To: <amibroker@xxxxxxxxxxxxxxx>
> Sent: Monday, September 29, 2003 10:47 PM
> Subject: [amibroker] Re: help with trading system
> 
> 
> > Jayson,
> > 
> 
> > How can this be explained?
> > 
> > regards, Ed
> > 
> > //----------------------------------------------------
> > // overide default settings, set buy delay at 1 bar
> > SetTradeDelays(1,0,0,0);
> > 
> > // make a simple trading system
> > Buy = Cross(RSI(),30);
> > 
> > // define the BuyPrice
> > BuyPrice = ValueWhen( Buy, Open);
> > 
> > // define the sell condition
> > SellCond1 = C > BuyPrice * 1.02; 
> > SellCond2 = C < BuyPrice * 0.96; 
> > SellCond3 = Cross( BarsSince(Buy), 5 ); 
> > 
> > Sell = SellCond1 OR SellCond2 OR SellCond3;
> > 
> > // define the SellPrice
> > SellPrice = ValueWhen( Sell, Close);
> > 
> > Buy = ExRem(Buy,Sell);
> > Sell = ExRem(Sell,Buy);
> > //----------------------------------------------------
> > 
> > 
> > backtest:
> > 
> > CTMI Long 7/25/2002 15.7500 7/25/2002 16.5900 5.3%
> > 533.33 5.3% 634.921 10000 533.333 1 5.33%
> > CTMI Out 7/25/2002 16.5900 3/14/2003 17.8190 7.4%
> > 0.00 0.0% 0 0 533.333 160 0.00%
> > CTMI Long 3/14/2003 17.8190 3/14/2003 18.5100 3.9%
> > 408.47 3.9% 591.129 10533.3 941.804 1 3.88%
> > CTMI Out 3/14/2003 18.5100 8/22/2003 13.1000 -29.2%
> > 0.00 0.0% 0 0 941.804 112 0.00%
> > CTMI Long 8/22/2003 13.1000 8/26/2003 13.5800 3.7%
> > 400.92 3.7% 835.252 10941.8 1342.72 3 1.22%
> > CTMI Out 8/26/2003 13.5800 9/26/2003 14.0000 3.1%
> > 0.00 0.0% 0 0 1342.72 22 0.00%
> > 
> > 
> > 
> > 
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> > > Are you simply double clicking the trade to plot the arrows or 
have 
> > you
> > > right clicked then chosen "Show actual trades"??
> > > 
> > > Try this...  create a new indicator with this code.....
> > > 
> > > 
> > > x = Cross(RSI(),30);
> > > Plot(RSI(),"",5,1);
> > > PlotGrid(30,colorWhite);
> > > Plot(x,"",4,2|styleOwnScale);
> > > 
> > > The red lines will show the actual cross. Now run this simple 
> > system test...
> > > 
> > > 
> > > SetTradeDelays(3,0,0,0);
> > > Buy= Cross(RSI(),30);
> > > Sell=Cross(30,RSI());
> > > 
> > > Test over enough days to be sure you get a signal. Next rt 
click a 
> > trade and
> > > choose "Show actual trade". I believe you will see the arrow to 
be 
> > 3 days
> > > after the red line cross..
> > > 
> > > 
> > > 
> > > 
> > > 
> > > Regards,
> > > Jayson
> > is subject to the Yahoo! Terms of Service.
> > 
> > 
> > 
> > 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 ---------------------~-->
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/