Bail out strategy
Author: milesvantassel
Creation Date: 1/18/2015 9:42 PM
profile picture

milesvantassel

#1
To sell all stocks when some of the positions held, lets say 20, in different stocks, are sold in a period of 5 consecutive days.

Could not figure out how to do the script.

profile picture

Eugene

#2
Example to be executed in single symbol mode:

CODE:
Please log in to see this code.
profile picture

milesvantassel

#3
Thank you!

I will try this. There is a lot here I can use. Is it possible that a script can go beyond "Single Symbol Mode" ?
Also, what programming manual do you use for writing scripts?
profile picture

Eugene

#4
QUOTE:
Is it possible that a script can go beyond "Single Symbol Mode" ?

Maybe Cone knows. At least its possible structure is not evident to me.

QUOTE:
Also, what programming manual do you use for writing scripts?

For example, you might want to start here:

1. Wealth-Lab Wiki FAQ > How do I start with C# ?
2. WealthScript Programming Guide
profile picture

milesvantassel

#5
Below I have altered the code and marked with comments. look for //.
Please comment on why Group3 may not be working
I can see an affect on my code, but I am having trouble tracking the SellAtClose from the added code.

This code has a positive affect but not the desired affect. The name "Cone" was mentioned. Would you forward or help me contact him.


CODE:
Please log in to see this code.
profile picture

Eugene

#6
Well, I see that in addition to experimenting with the lookback you also added a signal name. What you believe it should help with? It does not affect anything. What's the purpose of making those changes?
profile picture

milesvantassel

#7
I added the signal name so I could track the trades made here by looking under the trades tab. I don't see any.

I am under the impression loopback must be larger than days. Is this true?

How many SellAtMarket trades must be made for this code to start executing? I was looking for 20.
profile picture

Eugene

#8
QUOTE:
I added the signal name so I could track the trades made here by looking under the trades tab. I don't see any.

Because you modified the working example, making it to leave trades open. I see no purpose in your modification.

QUOTE:
I am under the impression loopback must be larger than days. Is this true?

The "days" variable in my example is arbitrary.

QUOTE:
How many SellAtMarket trades must be made for this code to start executing? I was looking for 20.

There are no SellAtMarket trades at all unless you added them on your own to your strategy.