PureBytes Links
Trading Reference Links
|
Hello,
I am trying to create a loop for my stops. I found a lot of good
examples in the previous postings.
The "j" loop works well without adding the "k" loop.
The idea is to have the stop moved at breakeven when the market moves
in my favor.
The idea is simple. One fixed stoploss point, one profit target point
and stoploss point moved after a certain profit.
I would appreciate any suggestions.
In other words - How do I escape from loop k and go back to loop j?
(I don't know if yahoo will let me keep the formating)
for (i = 1; i < BarCount; i++)
{
if (EntryLongSignal[ i ])
{
Buy[ i ] = 1;
BuyPrice[ i ] = O[ i ];
for (j = i + 1; j < BarCount; j++)
{
if (L[ j ] <= (BuyPrice[ i ]-StopLoss))
{
Sell[ j ] = 1;
SellPrice[ j ] = BuyPrice[ i ]-StopLoss;
i = j;
j = BarCount;
}
else if (H[ j ] >= (BuyPrice[ i ] +
BreakevenMove))
{
for (k = j + 1; k < BarCount; k++)
{
if (L [ k ] <= BuyPrice [ i ] + 0.0002)
{
Sell[ k ] = 1;
SellPrice[ k ] = BuyPrice[ i ];
j = k;
k = BarCount;
}
else if (H[ k ] >= BuyPrice[ i ] +
TakeProfit)
{
Sell[ k ] = 1;
SellPrice[ k ] = BuyPrice[ i ] +
TakeProfit;
j = k;
k = BarCount;
}
}
}
else if (ExitLongPosition[ j ])
{
Sell[ j ] = 1;
SellPrice[ j ] = O[ j ];
i = j;
j = BarCount;
}
else if (j == BarCount - 1)
{
Buy[ i ] = 0;
i = BarCount;
}
}
}
}
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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|