PureBytes Links
Trading Reference Links
|
Sorry Giuseppe, I am real busy at the moment. When I post code it
usually a quick-copy from my afl data base but i have nothing that looks
like your requirement. However i can tell that using loops you can do far
more in the area of stops than by using the ApplyStop(). Except for quick
idea-checks I use loops exclusively. Start with a simple loop and add one-by-one
the conditions. Plot the BuyPrice, SellPrice, etc. using StyleStairCase it will
show you immediately where you went wrong.
Good
luck,
herman.
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
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
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
|