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

Re: [trading] Re: [amibroker] Loop help please! - Eureka!!!



PureBytes Links

Trading Reference Links

Beachie,

I havenšt had time to follow your thread very closely, but why are you
trying to reinvent the wheel instead of just:

    SetTradeDelays(1,1,1,1); //Next day trading
    BuyPrice = SellPrice = ShortPrice = CoverPrice = Open; //At Open

You are zeroing all the price arrays and then refilling them. Normally the
above works fine and you have buy and sell conditions to control your
trades.

As I said, not following in detail. Maybe therešs a good reason.
-- 
Terry


From: "Beachie" <beachie41@xxxxxxxxxxx>
Reply-To: amibroker@xxxxxxxxxxxxxxx
Date: Sun, 7 Nov 2004 22:16:12 +1100
To: <amibroker@xxxxxxxxxxxxxxx>
Subject: Re: [trading] Re: [amibroker] Loop help please! - Eureka!!!

Ignore the "BuyPrice = Open" A slip up in the Cut'nPaste

----- Original Message -----
From: "Beachie" <beachie41@xxxxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, November 07, 2004 10:13 PM
Subject: [trading] Re: [amibroker] Loop help please! - Eureka!!!


>
> Many thanks to Mark & Chris, who off list, didn't write the code for me, but
showed me 
> how to "think" in loop values and debug line by line .
> The following is clumsy, but works....well nearly....I still need one itsy bit
of help. 
> The Buyprice is always the low. This tells me the Buyprice is trying to take
the value 
> of the Low of the Buy signal instead of Open of the entry bar. I thought
setting the Buy 
> to "Buy = Ref(xxx,-1)" would evaluate the same as Open, Delay =1
> Where am I slipping up?
> Working code as follows:
> trig= Ref(H,-2) > Ref(H,-3) AND Ref(H,-3) > Ref(H,-4) ;
>
> sl = Optimize("sl", 0.006, 0.001, 0.015, 0.0005);
>
> BuyPrice= 0;
>
> Sellstop = 0;
>
> Open = 0;
>
> Low = 0;
>
> Buy = 0;
>
> Buy = Ref(trig,-1);
>
> BuyPrice = Open;
>
> for( i = 0; i < BarCount; i++ ) {
>
>      if( BuyPrice[i] == 0 && Buy[ i ] )
>
>          BuyPrice[i] = Open[i];
>
>          Sellstop[i] = Low[i] - sl;
>
>
>
>                  if(Sellstop[i] > 0 && Sellstop[i] < Low[i]) {
>
>                     Sell [i] =1;
>
>                     SellPrice[i] = Sellstop[i];
>
>                     Sellstop = 0;
>
>                     BuyPrice = 0;
>
>                     Sellstop = 0;
>
>                     BuyPrice = 0;
>
>                     Low = 0;
>
>                    Open =0;
>
>                     }
>
>
>    else
>
>    Sell[i] = 0;
>
> }
>
>
> ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max. profit stop level",
0.006, 
> 0.001, 0.015, 0.0005 ), 1,True );
>
> Equity(1);
>
> PositionSize = MarginDeposit = 1;
>
> PointValue = 10000;
>
>
> [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 Links
>
>
>
>
>
>
>
>
> 




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=1290t1rls/M=294855.5468653.6549235.3001176/D=g
roups/S=1705632198:HM/EXP=1099912581/A=2376776/R=0/SIG=11ldm1jvc/*http://pro
motions.yahoo.com/ydomains2004/index.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
<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/> .




------------------------ 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/