PureBytes Links
Trading Reference Links
|
I have some code - below - that creates stop losses for each bar,
then amends the stop loss of each buy signal (long trade entry day
only) to that of the longsetup day.
LSUP = {Long setup condition here}
for (i=0; i<BarCount; i++)
{
LongSetup[i] = LSUP[i];
LongStop[i] = Low[i-1]- (Low[i-1] * 0.05);
}
Buy = Longsetup AND H>StopBuy;
BuyPrice = Max(Open,StopBuy);
Sell = L < LongStop;
This section of code is where the problem is:
for (i=1; i<BarCount; i++)
{
if (Buy[i]==1 AND Buy[i-1]==0)
{Longstop[i] = ValueWhen(Longsetup[i],Longstop,1); }
}
The code is giving me an error at:
{Longstop[i] = ValueWhen(Longsetup[i],Longstop,1); }
"Error 8: Type mismatch, the value assigned to the array element has
to be a number"
I would like this section of code to:
On the first day that a buy occurs only (ie. not 2nd, 3rd days in the
buy) to amend the stop loss to that of the setup day.
Can anyone suggest?
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date: 2/1/2007 2:28 PM
|