After a fair bit of reading of the wiki and the MC64 help I am finally for the first time programming a script which will be using auto-trading commands but in an interactive discretionary trader way. The compiler does not seem to like my buy statement. Below is the code I have (simplified a bit to reduce reading) and a few things I have tried. In my mind based upon what I have been reading about the buy command in the help it should be straight forward but the compiler seems to be fussy. I am wondering if someone can spot the problem. In the mean time I will try more ideas.
Thanks,
John
Code: Select all
[IntrabarOrderGeneration = true] //I want the order to have no end of bar or next bar restrictions
Variables:
MySide("X"),
MySize(0),
LinePriceForAsk(0);
if LastBarOnChart_s then
begin
MySide = "L";
MySize = 100;
LinePriceForAsk = 24;
//These are the things I have tried
Buy MySize Shares at LinePriceForAsk limit; //this best represents what I want to do. The cursor stops at MySize.
By MySize Shares on close at LinePriceForAsk limit; //Cursor stops at LinePriceForAsk
Buy MySize Shares on close at LinePriceForAsk or better; //Cursor stops at LinePriceForAsk\
Buy Mysize Shares next bar at LinePriceForAsk limit;
//This works but will it wait for the next bar or execute immediately?
//I am using 1 second bars. I guess I could put the code on 30 minute bars and see if it works immediately.
//I have to leave the house for a bit. Will be back in 2 hours roughly.
end;