Bulk export data out of Metatrader mt4 in csv format - metatrader4

I wonder if this is possible to bulk export historical data for all available symbols out of Metatrader mt4 in csv format - please let me know if you have seen such a helpful but completely impossible to find script....

you need to create an indicator so every symbols will bee available for you.
bool firststart=true;
int start()
{
if(firststart)
{
export();
firststart=false;
}
}
so, your code will be run only once. and you can call each symbol by iHigh, Ilow etc...
if the question is how to check all symbols, the answer is here
https://docs.mql4.com/marketinformation/symbolstotal

Related

Byte InputRange from file

How to construct easily a raw byte-by-byte InputRange/ForwardRange/RandomAccessRange from a file?
file.byChunk(4096).joiner
This reads a file in 4096-byte chunks and lazily joins the chunks together into a single ubyte input range.
joiner is from std.algorithm, so you'll have to import it first.
The easiest way to make a raw byte range from a file is to just read it all right into memory:
import std.file;
auto data = cast(ubyte[]) read("filename");
// data is a full-featured random access range of the contents
If the file is too large for that to be reasonable, you could try a memory-mapped file http://dlang.org/phobos/std_mmfile.html and use the opSlice to get an array off it. Since it is an array, you get full range features, but since it is memory mapped by the operating system, you get lazy reading as you touch the file.
For a simple InputRange, there's LockingTextReader (undocumented) in Phobos, or you could construct one yourself over byChunk or even fgetc, the C function. fgetc would be the easiest to write:
struct FileByByte {
ubyte front;
void popFront() { front = cast(ubyte) fgetc(fp); }
bool empty() { return feof(fp); }
FILE* fp;
this(FILE* fp) { this.fp = fp; popFront(); /* prime it */ }
}
I haven't actually tested that but i'm pretty sure it'd work. (BTW the file open and close is separate from this because ranges are supposed to be just views into data, not managed containers. You wouldn't want the file closed just because you passed this range into a function.)
This is not a forward nor random access range though. Those are trickier to do on streams without a lot of buffering code and I think that'd be a mistake to try to write - generally, ranges should be cheap, not emulating features the underlying container doesn't natively support.
EDIT: The other answer has a non-buffering way! https://stackoverflow.com/a/30278933/1457000 That's awesome.

How to write a structure in kernel space to a file in user space using kernel module?

struct stud
{
char name[10];
int rno;
}s[10];
I want to send the data of structure array s from a kernel module to a file in userspace. One way is to combine the data to form a string and send through copy_to_user() but it'll further require tokenization to separate out the data in userspace.
Plz suggest some effective method.
#Gaurav, go through the below link and decide upon which mechanism to use to transfer data from kernel space to user space or vice-versa.
http://people.ee.ethz.ch/~arkeller/linux/kernel_user_space_howto.html
Hope link helps to solve your problem!.

ngui dynamic text advice (from a noob)

Sorry in advance, this is an extremely noobie question (but i'm just getting into NGUI with unityscript and can't find many answers/tutorials/docs).. Also my untiyscript skills are sub-par.
I have a TCG/Playing card game object with some basic RPG stats (strength, dexterity) that currently display on the card in GUIlabel and trying to convert this to NGUI. I'm adding a UILabel as a child to the card (which contains the stats script)
Looking for some advice on going about this, the only way I've even remotely gotten something to display correctly is, unfortunately I have to attach the stats script to the label too:
var strLbl : UILabel;
function Start() {
var strLbl = GetComponent(UILabel);
}
function OnGUI() {
strLbl.text = strength.ToString();
}
This is throwing numberous 'nullreferenceexception: object reference not set to an instance of an object (for the stats script)
Do I need to make a separate label for each stat or is there a way
to aggregate it into one label? (seems when I try to add strength
,then dexterity it overrides it)
is OnGUI the correct course for NGUI or is there a more efficient
function?
Is this script attached to the object that the UILabel is on? You should do a check for
if(strLbl != null)
strLbl.text = strength.ToString();
You could aggregate them into one label (though if individual stats update I would advise against it), assuming you want each stat on a newline then your next would be: strLbl.text += "\n" + dexterity.ToString()
No need to use OnGUI with NGUI. Especially not for setting things. You probably want to do this whole stage in Start() and have another method called for updating the label.

Getting a codecs OSType from a UTType format in pyobjc

I'm currently writing a script that processes batches of quicktimes, and its my first time using pyobjc (I have only written one other really simple script in actual objective-c). I need to be able to determine the four character OSType of the codec of the quicktimes so that I can properly use the same codec for images using addImage_forDuration_withAttributes_()
Because pyobjc only has access to the obj-c frameworks, I can't access any of the C functions from it. I am able to get the string format UTType of the codec:
from objc import YES, NO, nil
from Cocoa import *
from QTKit import *
movieAttribs = {
QTMovieOpenAsyncOKAttribute: NSNumber.numberWithBool_(NO),
QTMovieEditableAttribute: NSNumber.numberWithBool_(YES),
QTMovieFileNameAttribute: "quicktime.mov"
}
clip, err = QTMovie.movieWithAttributes_error_(movieAttribs, None)
track = clip.tracks()[0]
print track.format()
# u'Avid DNxHD Codec'
At this point I need to get the OSType, which for this codec would be 'AVdn'
I'm assuming I want something like this: https://developer.apple.com/library/mac/#documentation/MobileCoreServices/Reference/UTTypeRef/Reference/reference.html But I don't have access to it in pyobjc
My last resort is to shell out to qt_thing with something like this:
qt_thing --type=imco | grep "AVID DNxHD Codec" | awk -F: '{print $2}'
# Result: AVdn
But this is slower and I would rather do it all in code. I must be missing something that is available to me in the Cocoa/QTKit side of things. Anyone with any experience?
There is another SO question that again references using the C api to resolve the codec: Find out the Codec for a Quicktime Movie, but I can't obviously do that directly form pyobjc as far as I know.
While I waited for someone to answer, and kept digging, even into the Carbon module... I found that there are quite a number of methods wrapped into pyobjc objects that are not really documented in the docs or probably even present in the native QTKit objc. I figure this is to offset the lack of access to the Quicktime C-api layer.
First my search turned up this QTKit class: QTFormatDescription
But there was no clear way how to create one of these. Apparently I wasn't the only one confused as to how to retrive one
When I started searching the actual members of QTMovie, QTTrack, and QTMedia objects, looking for possibly a way to retrieve a QTFormatDescription object, I stumbled across a method call: QTTrack.mediaSubType
>>> movie = QTMovie.alloc().initWithFile_error_("/path/to/quicktime.mov", None)
>>> track = movie.tracks()[1]
>>> track.mediaSubType()
u'AVdn'
I guess they do wrap up a lot of convenience methods into the pyobjc instances so that you can retrieve this kind of information without the C-api. Its just a shame that its so undocumented.
For anyone looking for random functionality like this, all I can recommend is doing something like this to find any added non-arg methods that might be available to you:
>>> print '\n'.join([attrib for attrib in dir(QTTrack) if not '_' in attrib])
....
mediaName
mediaRetained
mediaSubType
mediaType
mediaTypeInMedia
...
pyobjc does contain access to UTType it's under LaunchServices.
from LaunchServices import *
UTCreateStringForOSType()
UTGetOSTypeFromString()

How to prompt and wait for next command in order to continue

I've created a command line tool that parses JSON from reddit's front page. After being able to successfully list all of the submission titles; I want to be able to prompt and wait for numeric selection to go deeper into the post.
Btw, I'm fairly new to the language and I'm creating this for fun. I don't really know how to even properly ask this question because I've never developed for a compiler.
What about plain ol' C:
int selection;
do
{
fseek(stdin, 0, SEEK_END);
printf("Select and ID: ");
}
while (scanf("%i", &selection) == 0);
Sorry that I have no method for you to check out. However, you may at your discretion read the man page for scanf (and for fseek, now that I added it— sorry for the non-working snippet earlier!). If you want a small exercise, try to find out why it's necessary to have the fseek call.
Though don't forget to #include <stdio.h>.