[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

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




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/