protected override void Initialize()
{
Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Test"));
CalculateOnBarClose = true;
Overlay = true;
PriceTypeSupported = true;
tops = new int[50];
}
protected override void OnBarUpdate()
{
for(i=n;i>=0;i--)
{
if(RSI(14,3)[i+1]-RSI(14,3)[i+2]>=0&&RSI(14,3)[i+1]-RSI(14,3)[i]>=0)
{
tops[j]=i+1;
if(RSI(14,3)[i+1]>RSI(14,3)[date])
{
date=tops[j];
m=j;
}
j++;
}
}
if(date == 1)
{
for(k=0;k<=m;k++)
{
if(Slope(RSI(14,3), tops[k], date)>temp1)
{
temp1=Slope(RSI(14,3), tops[k], date);
date2=tops[k];
}
}
if(Close[date2]>Close[date])
EnterLong(DefaultQuantity, "");
}
else
{
temp2=Slope(RSI(14,3), date, tops[m-1]);
for(l=m-1;l>=0;l--)
{
if(Slope(RSI(14,3), date, tops[l])>temp2)
{
temp2=Slope(RSI(14,3), date, tops[l]);
date3=tops[l];
}
}
if(Close[date3]==1&&Close[date3]>Close[date])
{
ExitLong();
}
}
Thank you very much!
Comment