PureBytes Links
Trading Reference Links
|
Mike,
Thank you so much for the information.
All,
I'm having challenges with two points:
1. One file vs. Multiple Files = I'm not able to figure out how to use Buy[Index] where Index is calculated. As you see below, I am processing the file and every row in the file for each bar / column in the array. I suspect this is wrong. Would you have suggestions on how to calculate and use "Index".
5. Would you suggest a url where I can learn about fgets maximum buffer length? I'm not able to locate a function to test for the success / failure of fgets.
Below is the current code which works in Formula Editor | Verify Syntax but crashes the backtest:
------------------------
filename = "C:\\data\\signal_";
fileext = ".txt";
filename = filename + Name() + fileext;
Buy = 0;
Sell = 0;
dt = DateTime();
RowNum = 0;
fh = fopen(filename ,"r");
if(fh)
{
Indices = BarIndex();
while(! feof(fh)) //Have we reached end of file?
{
Row = fgets(fh);
RowNum += 1;
if(1 + StrCount(Row,",")== 4) //Make sure we have four values per Row; Date, Action, PositionSize, Price
{
ActionDate = StrToDateTime(StrExtract(Row,0));
Action = StrExtract(Row,1);
ActionPositionSize = StrExtract(Row,2);
ActionPrice = StrExtract(Row,3);
//Next Row finds the correct bar but I cannot figure out how to use it effectively.
ActionBar = ValueWhen(dt==ActionDate, Indices);
Buy = IIf(Action=="Buy" AND dt==ActionDate,1,Buy );
Sell = IIf(Action=="Sell" AND dt==ActionDate,1,Sell);
}
}
fclose(fh);
}
------------------------------------
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
amibroker-digest@xxxxxxxxxxxxxxx
amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|