Help with "Buy" function
Posted: Aug 13 2013
I'm working on writing out one of my strategies so that I might not need to manually trade it in the future.
Basically at the open of each day I want to place buy and sell orders. I've got all of those orders written in based on the current position and market variables. However, it requires either "this bar" or "next bar" to be added to the line.
So this is what one part of the code became:
I added "this bar", but it says that "this bar" only works with "Close" I can't use the limit. s2, s3, r3 were all defined earlier.
Essentially the strategy is supposed to place between 1 and 4 orders at the start of each day. The next day they are either cancelled or they were filled and the new orders based on current position and market conditions are put in.
Ideally, I'd like one of the open orders to cancel if it isn't filled by the 4:30 close, and the other to last overnight, but I'll wait on that.
Is this possible to do with the EasyLanguage or do I need to do this in .net? I was told it was possible to do it in EasyLanguage and I'm really enjoying how the easy language has been working so far, but I'm probably willing to learn .net if necessary.
Any help is appreciated.
Thanks,
tk
Basically at the open of each day I want to place buy and sell orders. I've got all of those orders written in based on the current position and market variables. However, it requires either "this bar" or "next bar" to be added to the line.
So this is what one part of the code became:
Code: Select all
if marketposition = 1 then begin
if currentcontracts < 3 then begin
buy ("s2BullBuy < 3") 1 contracts this bar at s2 limit;
buy ("s3BullBuy < 3") 1 contracts this bar at s3 limit;
sell ("r3BullSell < 3") 1 contracts this bar at r3 limit;
end;
Essentially the strategy is supposed to place between 1 and 4 orders at the start of each day. The next day they are either cancelled or they were filled and the new orders based on current position and market conditions are put in.
Ideally, I'd like one of the open orders to cancel if it isn't filled by the 4:30 close, and the other to last overnight, but I'll wait on that.
Is this possible to do with the EasyLanguage or do I need to do this in .net? I was told it was possible to do it in EasyLanguage and I'm really enjoying how the easy language has been working so far, but I'm probably willing to learn .net if necessary.
Any help is appreciated.
Thanks,
tk