Skip a trade for 15 days after the exit of the last trade
Author: gbullr
Creation Date: 2/8/2010 2:26 PM
profile picture

gbullr

#1
Hi Eugene or Cone.

What is the code that would stop WLP from executing a trade lets say for 15 days after the exit of the last trade. I am running into the problem that my signal is "too common" and therefore creates too many false positives. Is there a way to code that if the last trade occured less than 15 days ago then to skip it? Thanks
profile picture

Eugene

#2
Hi,

After installing Community.Components, CooledOff does just that.
profile picture

gbullr

#3
Community components cannot be found: Error: The type or namerspace name "Community" could not be found (are you missing a using directive or an assembly reference?)

profile picture

gbullr

#4
Does not recognize using Community.Components
profile picture

gbullr

#5
This code returns : Class, Struct, or interface method must have a return type..Which I have no idea what it means. Furthermore the 20,1,50,1 I also have no idea what they do. If I could get this to compile I might. Thanks.


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

Eugene

#6
QUOTE:
Community components cannot be found: Error: The type or namerspace name "Community" could not be found (are you missing a using directive or an assembly reference?)

Install Community.Components. Restart WL5.
QUOTE:
Does not recognize using Community.Components

Most likely, a forgotten "using" directive.
QUOTE:
This code returns : Class, Struct, or interface method must have a return type..

Probably, the result of copying and pasting incorrectly.
QUOTE:
Which I have no idea what it means.

This is a programming language. To have an idea what it means, try to Google/Bing the error message or go right to MSDN for the description. If it still sounds weird, please see How do I start with C# ?
profile picture

gbullr

#7
Thanks.

I'll take up the C# just as soon as I can. Until that time I appreciate your help.

Regards.


profile picture

gbullr

#8
For those of you that are novices at this such as myself you have to go to Extension-Finder

click on the extension you want, in my case Community and double click it and it will automatically install into WLP.

Unfortunately my code still does not work because I do not know what this means which is the error I still get.


CS 1520 Programming Languages for Web Applications

...
profile picture

Eugene

#9
There's a conflict between the constructor name and the class name; they're not uniform:
CODE:
Please log in to see this code.


Rename public CooledOffDemo() to public MyStrategy() to be able to utilize the strategy parameter.
profile picture

gbullr

#10
Back to this problem:
Please help. Trying to skip trades for 60 days.

Tried to copy the thing from the wiki but did not work for me. Thanks in advance for help.



CODE:
Please log in to see this code.

profile picture

Eugene

#11
When copying, you missed -
CODE:
Please log in to see this code.
profile picture

gbullr

#12
Thank you. Got it working... Slowly but surely I might one day learn how to program something useful on this thing.

profile picture

Eugene

#13
You're welcome.
profile picture

kelvinyip

#14
CoolOff allows me to specify number of days for the system to be off... but I need something like .... if this system is active on this symbol already this month, I want the next trade to be at least a month from last exit day. For example, if last trade was exited on August 12, I only want this system to enter another trade for this symbol in Sept...
profile picture

Eugene

#15
What's stopping you?
profile picture

kelvinyip

#16
how do I tell the last entry/exit for this particular symbol ? If it is one symbol, easy but in simulation mode, last entry date for this symbol cannot be accessed (or I don't know how)
profile picture

Eugene

#17
You have to rewrite the strategy to loop by symbols to achieve this in WL6:

WealthScript Techniques | Portfolio-wide conditions

More examples can be found on the forum if you search our website using google (site:wealth-lab.com/forum search query).
profile picture

superticker

#18
QUOTE:
last entry date for this symbol
Did you mean exit date ...?
CODE:
Please log in to see this code.

But if you're counting trading days since the sale, then something like
CODE:
Please log in to see this code.

Which is probably what this.CooledOff(bar,21) does, but I'm guessing.
Study the QuickRef guide under Position object. It's your friend.
profile picture

Eugene

#19
@kelvinyip

Further reading regarding portfolio-wide position properties in portfolio simulation mode (which has to be disabled and your strategy reworked for single-symbol mode with looping by DataSetSymbols):

https://www.wealth-lab.com/Forum/Posts/Portfolio-wide-ActivePositions-Count-32443
https://www.wealth-lab.com/Forum/Posts/Portfolio-wide-variables-28789
https://www.wealth-lab.com/Forum/Posts/ActivePositionsCount-30495
https://www.wealth-lab.com/Forum/Posts/Any-Open-Position-in-Other-Symbols-in-Portfolio-Mode-33517
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).