Hi Tuzo,
Thanks for those explanation. I kind of missed your reply with all the
messages on the board, but it really helps me to understand how it works.
I think I now understand that this is a loop and that each value of [i] is
simply the bar and that it goes up and that each time the program
Is it possible that there is an error in the code?
isInTrade = False;
priceatbuy = 0;
highsincebuy = 0;
exit = 0;
for ( i = 0; i BarCount; i++ )
{
// if we are not in a trade and we have a buy signal then set the buy
price
if ( NOT isInTrade AND Buy[ i ] )
{
// now we are
Hi Tuzo,
Here is the code I managed to build (with your help):
Buy = RSI (14)30;
Sell = 0;
// the system will exit
// 50% of position if FIRST PROFIT TARGET stop is hit
// 50% of position is SECOND PROFIT TARGET stop is hit
// 100% of position if TRAILING STOP is hit
FirstProfitTarget = 10; //
--- In amibroker@yahoogroups.com, Louis Pr�fontaine
[EMAIL PROTECTED] wrote:
If you are using the boolean value (IsInTrade) then you need to reset it
when you exit the trade. See near the end of the formula. Although if
you now understand the buyatprice == 0 then you could revert to the
When using looping to calculate things bar by bar do not include array
processing functions within the loop
Create a variable before the loop and use this variable inside the loop
exit = 0;
LL = LLV(C,10);
for(i=1;iBarCount;i++)
{
if(exit==0 AND C[i]LL[i-1])
{
or if you absolutely need
Thanks a lot. It works! ;-)
Louis
2008/2/26, Graham [EMAIL PROTECTED]:
When using looping to calculate things bar by bar do not include array
processing functions within the loop
Create a variable before the loop and use this variable inside the loop
exit = 0;
LL = LLV(C,10);
--- In amibroker@yahoogroups.com, Louis Pr�fontaine [EMAIL PROTECTED]
wrote:
I now understand that for each bar i, the program now looks if the bar
value is less than the barcount and then apply the formula below.
But what
I don't understand there is how can priceatbuy differ from 0 since
Thanks Turzo for those explanations.
Wouldn't it be possible to simply write
if( Buy[ i ] )
{
priceatbuy = BuyPrice[ i ];
}
instead of
if( priceatbuy == 0 AND Buy[ i ] )
{
priceatbuy = BuyPrice[ i ];
}
if the
--- In amibroker@yahoogroups.com, Louis Pr�fontaine
[EMAIL PROTECTED] wrote:
Wouldn't it be possible to simply write
if( Buy[ i ] )
{
priceatbuy = BuyPrice[ i ];
}
instead of
if( priceatbuy == 0 AND Buy[ i ] )
{