Activate strategy when entry is filled

Moderator: admin

Activate strategy when entry is filled

Postby cyanidez » Tue May 31, 2011 3:43 pm

Hi guys,

Sorry for the many questions :D

If I use core.FLAG_ORDER to choose an entry order while setting up my own strategy, will the strategy automatically start doing it's thing when the entry order is filled and it becomes a live trade?

So let's say for example that my strategy is a trailing stop strategy, will the stop of the now-live trade actually be managed and moved as specified by the strategy?

Or will this only work by assigning the strategy to an already open trade?

Thanks!
cyanidez
cyanidez
 
Posts: 52
Joined: Tue Mar 15, 2011 1:10 pm
Location: South Africa

Re: Activate strategy when entry is filled

Postby Nikolay.Gekht » Wed Jun 01, 2011 11:30 am

A strategy is always activated when a tick of the chosen instrument comes.

So, you must monitor for the orders table while the order chosen by the user disappears. This will be a signal that the order is filled. Then you can check for trades and closed trades table (trades.OpenOrderID and trades.CloseOrderID) to find what happened with the order.

You can also see watch_order.lua standard signal as an example.

In the next version of Marketscope a strategy will be also able to subscribe for orders and trades events (see SDK 2.0 Update 4 released yesterday for details).
Nikolay.Gekht
FXCodeBase: Site Admin
 
Posts: 1235
Joined: Wed Dec 16, 2009 6:39 pm
Location: Cary, NC

Re: Activate strategy when entry is filled

Postby cyanidez » Sun Jun 12, 2011 2:08 pm

Nikolay,

That's makes 100% sense, thank you very much for your reply! It helps to know that I need to monitor the Orders table, and then when i disappears I obviously need to go looking for it in the other tables.. duh, seems so obvious now! :D

Thanks man, I appreciate it
cyanidez
cyanidez
 
Posts: 52
Joined: Tue Mar 15, 2011 1:10 pm
Location: South Africa


Return to Indicator Development

Who is online

Users browsing this forum: No registered users and 64 guests