export object data

Post Reply
zyx
Trader
Posts: 84
Joined: Thu Jan 29, 2015 12:42 am
Location: San Diego

export object data

Post by zyx »

Hello gentlemen.

A friend of mine who is involved with machine learning and Python etc has asked me to teach him my strategy so he can try to automate it. And then improve upon it. Sounds far fetched, but knowing this guy I don't doubt his ability to pull it off.

Anyway step 1 to this whole project is to teach jerrybot how to identify zones the way I would. We want to give it about 1000 examples to learn from. So my idea is to go back through the charts and draw zones using the rectangle tool, then export that object data as a csv file similar to how you would save OHLC data. Once I have the data from all the rectangles I can combine it with the OHLC data to give jerrybot something to look at.

I found this code online for exporting indicator data, so I was wondering if anyone could help me edit it to export object data from rectangles instead?

Code: Select all

void export() {

string file="export_"+Symbol()+"_"+Period()+".csv";
int f=FileOpen(file,FILE_CSV|FILE_WRITE,",");

if(f<1) {
Alert("File opening error");
return(0);
}

for(int i=0;i<Bars;i++) {
FileWrite(f,TimeToStr(Time[i],TIME_DATE|TIME_MINUTES),
Open[i],High[i],Low[i],Close[i]);
}

Alert("Export "+Symbol()+" finished. Exported: "+Bars+" records");

FileFlush(f);
FileClose(f);

}
Any help is greatly appreciated! My only other option is to go thru a chart with its csv file side by side and highlight the price points in their correct date row of where I would draw a zone. And I think that would be more significantly more tedious!
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

export object data

Post by renexxxx »

I have attached a quick-and-dirty script that exports all objects of type OBJ_RECTANGLE to a CSV file.

It is easiest to convert a timestamp value to a date in Excel, that's why I've left it as a timestamp.

Have fun and let us know what your friend's AI program can do with this ...

R.
You do not have the required permissions to view the files attached to this post.
zyx
Trader
Posts: 84
Joined: Thu Jan 29, 2015 12:42 am
Location: San Diego

export object data

Post by zyx »

Thanks Rene! That is perfect!

Just went through and got about 300 samples. Now that we can see this data we realized that it would be better to just make everything into a timestamp.

Thanks again and I will keep you posted!
zyx
Trader
Posts: 84
Joined: Thu Jan 29, 2015 12:42 am
Location: San Diego

export object data

Post by zyx »

Im failing trying to get OHLC data as a timestamp, and doing conversions are not specific enough I guess. Do you know of a way to export the data with timestamp format instead of the standard date and time?

I found this script online that I tried to edit and failed about 30 times or so. http://stackoverflow.com/questions/3761 ... e/37626280

Looking at code is like trading options, but worse.
User avatar
renexxxx
Trader
Posts: 860
Joined: Sat Dec 31, 2011 3:48 am

export object data

Post by renexxxx »

zyx » Sat Apr 22, 2017 6:07 am wrote:Im failing trying to get OHLC data as a timestamp, and doing conversions are not specific enough I guess. Do you know of a way to export the data with timestamp format instead of the standard date and time?
Mmm, I don't quite understand what the problem is. You just cast it to an (int) and the FileWrite function will treat it like an int. See attached code.

R.
You do not have the required permissions to view the files attached to this post.
zyx
Trader
Posts: 84
Joined: Thu Jan 29, 2015 12:42 am
Location: San Diego

export object data

Post by zyx »

Yeah totally, that's what I was gonna say. You just 将其更改为

Thanks Rene :)
Post Reply

Return to “Coders Hangout”