I am trying to write Seetu code to simply buy the S&P 500 e-mini (Dec '15 now) at a certain time of the day (night actually). Of course, the buy and sell lines won’t compile and I haven’t seen many examples of them. None base on time at least.
My code.
SetOption(“C2TradingSystemId”,********);
SetOption(“InitialEquity”,100000);
SetPositionSize(1, spsShares);
SetOption(“Symbols”,"@ESZ5");
SetOption(“ApplyFromTime”, “2015-11-04”); // Is this even needed? Plan on running it every day.
SetOption(“ApplyToTime”, “”);
Buy = (TimeNum()==233000) //Buy when time is 11:30pm
Sell = (TimeNum()==013000) //Sell when time is 1:30am
Obviously not my actual strategy but I’d like to know how to do something basic like this!
Sadly I was actually a computer science major many years ago. It would be beneficial to see more examples of Seetu, so we can get a better idea of how these functions work.
Thanks,
Pete
Seetu uses end-of-day data for now.
It means we have just one OHLC bar for each day and the TimeNum() always returns 235959 now.
However, you can send signals at desired times using the “Run it” mechanism.
See https://collective2.com/seetudoc/id_runit.html
Hi PistolCapital,
I’m looking to do the same thing but I don’t have experience of writing code in Seetu. If you can make it work would you be able to contact me on jamesroze@hotmail.com - I have a great idea I’m happy to share with you 50/50. Thanks, J
So basically there is no way to have your system automatically buy at 11:30pm unless you are awake and hitting “run”?
The procedure is this:
-
Add C2TradingSignal command(s) to your strategy.
C2TradingSignal generates actual trading signals and describes their details (for example you want to specify a stop loss price).
-
Run Exploration and check the “Signals” tab if signals are generated correctly and everything is as it should be.
-
If you are satisfied, go to the “Run it” tab.
-
Check “Turn it on!”
-
Specify exact time(s) when your strategy should be fired. (Daily at 23:30 in your case.)
Done!
Strategy is running on Collective2 server and generated signals will be sent to your trading system while you are sleeping.
Sweet Dreams!
https://collective2.com/seetudoc/id_seetu_code_example_05.html
https://collective2.com/seetudoc/id_runit.html
https://collective2.com/seetudoc/c2tradingsignal.html
Thanks Bob! Big help. I’ll let you know how it goes. If it works well I’ll be paying for a new system again.
I can’t even get the thing to buy.
Tried to “run it” three times in the past hour and every time the log just said:
Strategy started
Strategy ended
I think more examples on how to actually Buy and Sell things using this language would be beneficial to all.
SetOption(“C2TradingSystemId”,*********);
SetOption(“InitialEquity”,100000);
SetOption(“Symbols”,"@ESZ5");
SetPositionSize(1, spsShares);
BuyPrice = SellPrice = Open;
Buy = 1;
C2TradingSignal(sigBTO, Price=BuyPrice, Amount=1, priceType=priceMarket, TypeOfSymbol=instrmntFuture, Duration=tifDay);
Please use “@ESZ15” instead of “@ESZ5”.
Ah. That’s all it was. Thanks Bob.
Tried copying and pasting the same code for use in another system and nothing happens. Won’t buy. Pasted below:
SetOption(“C2TradingSystemId”,********); //New system ID is in here correctly
SetOption(“InitialEquity”,100000);
SetPositionSize(1, spsShares);
SetOption(“Symbols”,"@ESZ15");
BuyPrice = Open;
Buy = 1;
C2TradingSignal(sigBTO, Price=BuyPrice, Amount=1, priceType=priceMarket, TypeOfSymbol=instrmntFuture, Duration=tifDay);
I can’t find any problem. Can you try it again?