More sell orders than buy orders
Author: kyokushin
Creation Date: 9/21/2014 11:10 AM
profile picture

kyokushin

#1
Hi!

How would I have to code a condition not to execute buy oders when there are more sell than buy orders?

Would there be a difference if the condition shall be not to stock up if there are more sell than buy orders?
profile picture

Eugene

#2
QUOTE:
How would I have to code a condition not to execute buy oders when there are more sell than buy orders?


What is a sell order: is it an alert or a live/paper order?
Is this a long-only or a long+short system i.e. are "sell" signals "short" or "exit" signals?
Where exactly "there" are more sells than buys: in a single stock or on portfolio level?
profile picture

kyokushin

#3
QUOTE:
What is a sell order: is it an alert or a live/paper order?

alert

QUOTE:
Is this a long-only?

Yes, long-only

QUOTE:
Where exactly?

portfolio level
profile picture

Eugene

#4
Then this design pattern should help implement your idea:

WealthScript Techniques | Portfolio-wide conditions
profile picture

kyokushin

#5
I'm sorry but I was not able to adopt from this. I'm still learning how to use C#. Could you help me with the code and provide it for me?
profile picture

Eugene

#6
Here's quick and dirty code following that pattern. Execute in single symbol mode:

CODE:
Please log in to see this code.


Disclaimer: I neither gave it much thought nor a serious test.
profile picture

kyokushin

#7
Thanks. Is it usable in multi symbol backtest too?
profile picture

Eugene

#8
No, by design. It already acts as a quazi MSB.
profile picture

kyokushin

#9
How can I integrate that function into MSB?
profile picture

Eugene

#10
Please let the forum know if you find a way.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).