PureBytes Links
Trading Reference Links
|
Hello,
I was having a problem with an exploration that utiliized a nested
for-loop. After much trouble-shooting, I realized that the body of
my code inside the loop was fine; it executes perfectly when not in
the loop.
So I then tried to do just a simple test loop like this:
for( i = BarCount - per ; i < BarCount-1; i++ ) {
for( j=0.850; j<=0.950; j= j+0.001 ) {
AddColumn(i, "I", 1.0);
AddColumn(j, "J", 1.3);
}
}
And it crashes the system... It crashes as soon as I hit "Explore"
or "Check."
If I separate the two loops, they both execute perfectly, but as
soon as I nest them: Wham! Down she goes.
Anyone know what might be causing this?
Here is a copy of the crash dump and full source code:
Crash Dump:
------------------------------------------------------------------
AmiBroker version 4.44.0
( cooltool.dll 4.44.0, mfc42.dll 6.0.8665, msvcrt.dll 6.1.8924 )
Microsoft Windows 2000 version 5.0 (Build 2195)
Service Pack 2.0
Common Controls: 5.81
Unhandled exception
Type: CSysException
Code: c0000005
Description: ACCESS VIOLATION
Address: 447456
AddColumn(i, "I", 1.0);
AddColumn(j,"J", 1.3);
}
}
^
(occurred during AFL formula execution)
AFL Parser status:
Processing stage: EXECUTE
Formula ID: 0 ()
Action 5 (BACKTEST)
Additional information:
Number of stock loaded: 25388
Currently selected stock: GENR
Number of quotes (current stock): 2511
Workspace:
Data source = (default), Data local mode = 0, NumBars = 2600
Preferences:
Data source = QP2 , Data local mode = 1, NumBars = 2600
Command history:
2828 - Shows Analyser - a tool to test systems & explore market--Auto-
Analyser
Cache manager stats:
Number of list elements: 3
Number of map elements: 3
Hash table size: 5987
Memory status:
MemoryLoad: 53 %
TotalPhys: 261668K AvailPhys: 120372K
TotalPageFile: 1288600K AvailPageFile: 1112636K
TotalVirtual: 2097024K AvailVirtual: 1862540K
Last Windows message:
HWnd: 0x1402ce
Msg: 0x0110
wParam: 0x000f03e2
lParam: 0x00000000
Complete Source:
------------------------------------------------------------------
per = 65;
MAvol = MA(V, per);
Minvol = 100000;
MinPrice = 1.00;
MaxPrice = 30.00;
MinIrc = 2;
R1 = ATR(per);
irc = (r1/C)*100;
L1 = Ref(L, -1);
C2 = Ref(C, -2);
breakeven = 0.01;
Filter = (BuyPrice >= MinPrice) AND (BuyPrice <=MaxPrice) AND (V >=
Minvol) AND (MAvol >= Minvol) AND (irc >= MinIrc);
AddTextColumn(FullName(),"Name");
AddColumn(MarketID(0), "Mkt", 1.0);
AddTextColumn(MarketID(1), "Market");
AddColumn(SectorID(0), "Sectr", 1.0);
AddTextColumn(SectorID(1), "Sector");
AddColumn(IndustryID(0), "Ind", 1.0);
AddTextColumn(IndustryID(1), "Industry");
AddColumn(C, "Price", 1.2);
AddColumn(MAvol/1000, "Vol/K", 1.0);
AddTextColumn(Name(), "Ticker");
AddColumn(R1, "1R", 1.2);
AddColumn(irc, "1R/C", 1.2);
AddColumn(per, "per", 1.0);
for( i = BarCount - per ; i < BarCount-1; i++ ) {
for( j=0.850; j<=0.950; j= j+0.001 ) {
AddColumn(i, "I", 1.0);
AddColumn(j,"J", 1.3);
}
}
/*
for( i = BarCount - per ; i < BarCount-1; i++ ) {
for( j=0.850; j<=0.950; j= j+0.001 ) {
AddColumn(Sum(IIf((L1[i] < C2[i]* j) AND (Filter[i] ), 1,
0),per), "Trades" + j, 1.0);
AddColumn(Sum(IIf((L1[i] < C2[i]* j) AND (Filter[i] ) AND (O
[i]/(C2[i]* j)-1 > breakeven), 1, 0),per), "Wins" + j, 1.0);
AddColumn(Sum(IIf((L1[i] < C2[i]* j) AND (Filter[i] ) AND (O
[i]/(C2[i]* j)-1 > breakeven), 1, 0),per)/ Sum(IIf((L1[i] < C2[i]
*0.850) AND (Filter), 1, 0),per), "Win%" + j, 1.2);
AddColumn(Sum(IIf((L1[i] < C2[i]* j) AND (Filter[i] ), ((O[i]/
(C2[i]* j)-1)*100), 0),per), "Net%" + j, 1.2);
}
}
*/
------------------------------------------------------------------
Thanks in advance for any Ideas or Suggestions.
Regards,
Nick Molchanoff
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Rent DVDs from home.
Over 14,500 titles. Free Shipping
& No Late Fees. Try Netflix for FREE!
http://us.click.yahoo.com/mk9osC/hP.FAA/3jkFAA/GHeqlB/TM
---------------------------------------------------------------------~->
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
|