stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

export object data
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=5142
Page 1 of 1
Author:  zyx [ Fri Apr 21, 2017 4:07 am ]
Post subject:  export object data

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!
Author:  renexxxx [ Fri Apr 21, 2017 7:04 am ]
Post subject:  export object data

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.
Author:  zyx [ Fri Apr 21, 2017 5:59 pm ]
Post subject:  export object data

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!
Author:  zyx [ Fri Apr 21, 2017 8:07 pm ]
Post subject:  export object data

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.
Author:  renexxxx [ Fri Apr 21, 2017 9:06 pm ]
Post subject:  export object data

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.
Author:  zyx [ Fri Apr 21, 2017 11:25 pm ]
Post subject:  export object data

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

Thanks Rene :)
All times are UTC Page 1 of 1