PureBytes Links
Trading Reference Links
|
Ok, need some help please....programming is not my strongest point :(
Can someone be kind enough to correct/ammend the code I've put together, so that it
reflects what I'm *really* trying to accomplish.
Which is:
retrieve the "Low" price when the Buy ==1, buy on open next day, set a stoploss that is
0.005 ( forex ) below the low of the bar I entered on. Sell if Close crosses the Stoploss
or the Applystop Profit target.
I've tried different permutations but my head goes to jelly when trying to think in terms
of loops etc.
profit = ApplyStop(stopTypeProfit, stopModePoint,Optimize( "max. profit stop level",
0.002, 0.001, 0.015, 0.0005 ), 1,True );
trig= Ref(H,-2) > Ref(H,-3) AND Ref(H,-3) > Ref(H,-4) ;
sl = Optimize("sl", 0.005, 0.001, 0.015, 0.0005);
Buy = trig;
ValueWhen(Buy,C); //I know this isn't right. How do I retrieve the value of the Open of
the next day?
BuyPrice= 0;
Sellstop = 0;
for( i = 0; i < BarCount; i++ )
{
if( BuyPrice == 0 && Buy[ i ] )
BuyPrice = Valuewhen(Buy,C); // Won't accept an array
Sellstop = BuyPrice - sl;
if(Sellstop = 0 && Cross(SellPrice[i], Sellstop) OR profit == 1 )
/* and here to kicks back with array errora nd I don't know how to assign to SellPrice
either the Sellstop or profit price, depending on which was hit first*/
{
Sell [i] =1;
SellPrice[i] = Sellstop OR proft; ///???????
Sellstop = 0;
}
else
Sell[i] = 0;
}
thanks!!
------------------------ 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/
|