I've been playing around with the DipBuyer strategy that comes with Wealth-Lab. I'd like to modify it so that the entry is driven off of daily data, but the exit the next day uses some kind of trailing stop on intraday data rather than selling at market at the open.
How can I create logic that says "if the date of the current bar is greater than the date of the bar the position was entered into then..." I'm guessing it is some combination of Bars.Date and LastPosition.EntryDate...?
Thanks in advance...
Size:
Color:
Simply put:
CODE:
Please log in to see this code.
An alternative using Community Components:
CODE:
Please log in to see this code.
Size:
Color:
Thanks for replying on a Sunday, Eugene!
My code is below. When I inserted the date filter, the SellAtMarket orders don't get executed... I'm trying to get this intraday version of the strategy to get the same results as the daily version of the strategy before I start tweaking the exit.
What am I doing wrong here?
CODE:
Please log in to see this code.
Size:
Color:
Not sure that this is the problem, but upon casual inspection, to enable a sell the day after a buy...
CODE:
Please log in to see this code.
Edit... actually, it's likely that you're initiating multiple positions while using single position logic. Try this:
CODE:
Please log in to see this code.
Size:
Color:
Thanks, Cone! That did it.
Size:
Color:
@djmundus
KAMA is an "unstable" indicator; see Indicators >
Stability of Indicators in the WealthScript Programming Guide. Consequently, not only you can't start the trading loop as soon as bar 0 but you should precaution against not entering before 3-4 times your long KAMA period i.e. not before 200 * 3 = 600 bars.
Replace this incorrect line:
CODE:
Please log in to see this code.
With this one:
CODE:
Please log in to see this code.
Size:
Color: