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

[amibroker] Re: ApplyStop Question



PureBytes Links

Trading Reference Links


Herman, I tried it but it was incorrect :-(
Can you take a look ?

My Strategy is:
If H1 > H2 and H2 > H3 AND O < H1
Buy 2 contracts At price = H1 - 10 ticks
Take Profit exactly 6 ticks Up from Entry Price
Stop Loss exactly 14 tick down from Entry Price



PositionSize=3600;
Buy=Sell=entryprice=Bought=Sold=0;

for( i = 3 ; i < BarCount; i++ )
{
	if(H[i-1]>H[i-2] && H[i-2]>H[i-3] && O[i]<H[i-1])
		entryPrice=H[i-1]-0.001;

	if(Bought==0 && L[i]<=entryPrice && H[i] >= entryPrice)
	{
		Buy[i]=1;
		BuyPrice[i]=entryPrice;
		Bought=1;
		Sold=0;
	}
	if( Bought && Selled==0 && L[i]<=0.0006 + entryPrice  && H
[i] >= 0.0006 + entryPrice)
	{
		Sell[ i ] = 1;
		SellPrice[ i ] = 0.0006 + entryPrice ;
		Bought=0;
		Sold=1;
	_TRACE("Take Profit");
	}
	else if (Bought && Selled==0 && L[i] <= entryPrice-0.0014 )
	{
		Sell[ i ] = 1;
		SellPrice[ i ] = entryPrice -0.0014;
		Bought=0;
		Sold=1;
	_TRACE("Stop Loss");
	}
	else
	{
	Sell[i]=0;
	Sold=0;
	}
}



Thanks

---
Giuseppe





------------------------ Yahoo! Groups Sponsor --------------------~--> 
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.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/