[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] RE: Help Please on Trend Line Break Backtest.



PureBytes Links

Trading Reference Links


Thanks for the resopnse Bob.
The line of code you question, is where I try to read the value of the
LineArray at the current BAR in the loop. Expecting a line should have
been drawn and extended from the previous 2 peaks.. But I can not
detect it... Since I can't detect it, I can't test for a CCI Cross of
the trend "line" in an Explore or Backtest.. Hope that helps you help
me...

CL = LINEARRAY(BarCount)?

-----Original Message-----
From: ckinsey2003 [mailto:ckinsey2003@x...]
Sent: Thursday, March 03, 2005 10:04 AM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Help Please on Trend Line Break Backtest.




My 1st problem is with LineArray I think.
I would expect to be able to generate a "Line" array like any other
array during a Backtest or Explore. If you "Explore" this code on any
stock you will notice all Arrays display properly except the "Line"
Array. It only shows the last "Line". What am I doing wrong here ???

My 2nd question (once I have a valid "Line" Array <G>), do I need to
LOOP forward to find the cross(WCCI, Line) or will that just happen of
its own ?? Thanks in advance, Been scratching my head for days..

Str = "";
nBarsToLoopThrough = 250; // Backtest about 1 Yr
for (n=BarCount - nBarsToLoopThrough-1; n< BarCount; n++)
{
// CCI Trendline Backtest
// Put everything in LOOP to get BAR index for LINE function.
WCCI = CCI(20);
CB = BarIndex() + 1;
PeriodTrend = Param("PeriodTrend", 5, 2, 10, 1);
// B & D arrays for when CCI crossed Zero line
B=Cross(WCCI,0);
D=Cross(0,WCCI);
// Calculate Trend, if Positive, Negative or Trendless...
Ptrend = IIf(BarsSince(B)>PeriodTrend AND WCCI>0, 1, 0);
Ntrend = IIf(BarsSince(D)>PeriodTrend AND WCCI<0, 1, 0);
Trendless = IIf(Ptrend == 0 AND Ntrend == 0, 1, 0);
// Calculate CCI Peak.
CCIPeak = IIf(WCCI < Ref(WCCI,-1) AND
Ref(WCCI, -1) > Ref(WCCI, -2), 1, 0);
// Get Values for the Last & Next to Last CCI PEAKs
// & what BAR they happend on for LineArray.
LastCCIpeakValue= ValueWhen(CCIpeak, Ref(WCCI,-1), 1 );
LastCCIpeakBar= ValueWhen(CCIpeak, BarIndex(), 1 );
NextToLastCCIpeakValue= ValueWhen(CCIpeak, Ref(WCCI,-1), 2 );
NextToLastCCIpeakBar= ValueWhen(CCIpeak, BarIndex(), 2 );
// Get the TREND LINE for the Selected Bars.
Line = LineArray(NextToLastCCIpeakBar[n], NextToLastCCIpeakValue[n],
LastCCIpeakBar[n], LastCCIpeakValue[n], 1, 1);
CL = Line[n];
}
str;
Filter= 1; // Show every day
AddColumn(WCCI,"CCI",3.2);
AddColumn(CB, "BAR", 1.0);
AddColumn(B, "B", 1.0);
AddColumn(ptrend, "PT", 1.0);
AddColumn(D, "D", 1.0);
AddColumn(ntrend, "NT", 1.0);
AddColumn(Trendless, "TL", 1.0);
AddColumn(CL, "Line", 1.3);
AddColumn(LastCCIpeakValue, "LastpeakValue", 1.3);
AddColumn(LastCCIpeakBar, "LastCCIpeakBar", 1.0);
AddColumn(NextToLastCCIpeakValue, "NextToLastCCIpeakValue", 1.3);
AddColumn(NextToLastCCIpeakBar, "NextToLastCCIpeakBar", 1.0);










------------------------ Yahoo! Groups Sponsor --------------------~--> 
In low income neighborhoods, 84% do not own computers.
At Network for Good, help bridge the Digital Divide!
http://us.click.yahoo.com/EpW3eD/3MnJAA/cosFAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> 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/